• подарки оптом, подарки опт
  • сувениры оптом, сувениры опт
  • бизнес сувениры
  • бизнес подарки
  • сувенирная продукция
  • купить футболки
  • бейсболки
  • ежедневники, ежедневник
  • подарки для женщин
  • подарки для мужчин
  • стеклянные двери
  • стеклянные перегородки
  • cтеклянные лестницы
  • изделия из нержавейки
  • UDK

    Grayscale images and texture compression

    In realtime graphics grayscale images are often used as masks in shader and particle effects. In many cases (lensflares or vector masks for example) compression artifacts can become a problem.

    The following table is a comparison between a few of the compression schemes present in current UDK builds. (The images are closeups of a shader using the textures, click for a bigger view.)

    256×256 – G8 – 86 KB

    This TC_Grayscale compression simply drops the green, blue and alpha channels so the result is the untouched red component.

    Advantages: There are no DXT compression artifacts.

    Disadvantages: Can not store multiple masks in a single texture.

     

    256×256 – DXT1 – 43 KB

    TC_Default produces a DXT1 encoded texture. It reduces fidelity in 4×4 pixel blocks.

    Advantages: Can store three masks with the same (small) memory footprint.

    Disadvantages: Compression artifacts might be unacceptable on clip art/vector style images or smooth gradients.

    512×512 – DXT1 – 171 KB

    Doubling the resolution of the previous image helps maintaining the sharp edges but there are still ugly blocking at certain places.

    Gradients look much better although gamma correction can affect the result.

     

     

    1024×1024 – DXT1 – 683 KB

    At 4x the resolution of the original image, it starts to look really sharp with only a few errors in the contours.

    The change in gradient quality is barely visible, probably isn’t worth the extra memory usage by itself.

     

     

     

    128×128 – V8U8 – 43 KB

    The TC_NormalmapUncompressed scheme stores the red and green channels uncompressed and derives the blue (Z) component in the pixel shader (+2 instructions).

    Advantages: Can store two masks in the same texture, no DXT compression artifacts.

    Disadvantages: Each texture sampler increases the pixel shader’s instruction count by 2 or 4 if the texture values are remapped to the [0,1] range.

    256×256 – V8U8 – 171 KB

    After choosing the V8U8 compression, UDK automatically halves the resolution in order to keep size the same as with DXT1. (This is why the previous image is 128×128.)

    A 512×512 imported image ended up being 256×256, same size as the 512×512 DXT1 compression. The decreased resolution certainly shows but at least the quality is consistent throughout the image. It would work much better for distance fields than DXT1.

    So the bottom line is that the ideal compression method depends on several factors: the content of the image, the memory and shader instruction limitations and workflow considerations.

    Written on May 15th, 2011
    Categories: UDK

    New tutorial about reflections

    Here is a new tutorial:

    Reflections in Unreal
    View "logo.jpg"A few words on different reflection types, their usage and implementation in Unreal. Read>>

    Enjoy. :)

    Written on February 6th, 2011
    Categories: My projects, Tutorials, UDK
    Tags: ,

    GViz features: The character shader

    (This series of articles is about the capabilities of GViz, a machinima toolkit for UDK.)

    The ingame shader for the characters is mostly done.
    It can create generic materials:

    (Yeah, Victor sometimes resembles another guy also on the ICAO alphabet…)

    But it also has features specifically made for virtual actors:

    The most apparent of those is the clothing: the different parts of the garment can be independently colored or removed.

    To achieve this, the mesh has a second UV set (along with a full unwrap) which maps a small texture of 8 different colors:

    Each color identifies a piece of clothing. The shader creates black and white masks from these colors using basic math then blends in the related color parameters of the current material instance.

    The order of colors is important: the border between masking colors usually appear in the middle of polygons as opposed to polygon edges. This way the position and shape of the end of clothing pieces are not restricted by the topology of the mesh. You can see that on the zoomed in view of the knee: the shorts has an edge pretty different from the edge flow of the geometry.

    The bilinear filtering is turned off so no blending occurs between the colors, as it screws up the mask generation later on.

    The arrows show the order of clothing pieces: Black means uncovered skin, white is “cap” (or hair). Red is the T-shirt which has two neighbors, the green long sleeves and the cyan pants, and so on.

    Otherwise the character uses 3 more, grayscale textures: diffuse map (only in the case of the camo guy), a cavity map and an accessibility map. The latter is a combination of 3DS Max’s subsurface scattering approximation and ambient occlusion maps.

    Another (optional) texture is for the “logo”, some kind of a pattern on the clothes. It’s basically a distance field image baked onto the low poly geometry. The DF was generated from black and white patterns, in this case lines made in Illustrator.

    Since it’s a distance field, changing the thickness and border smoothness of the shapes are easy. In theory all the fancy stuff I wrote about earlier could be implemented but I’m not sure it will be necessary.

    Now I go back to fix a few things in the geometry then it’s time to make the final skeleton and the skinning.

    Written on October 21st, 2010
    Categories: Gavit, My projects, UDK

    GViz features: Distance field based decals

    (This series of articles is about the capabilities of GViz, a machinima toolkit for UDK.)

    I’ve made a distance field based decal shader, similar to what is described in Valve’s excellent paper.

    The following images show an extreme example, a 64×64 grayscale texture rendered up close using different settings:

    Apparently, simple, sans-serif fonts work much better than more detailed ones. The distance between characters and from the edge of the image also has an impact of the result, especially when using outlines and shadow.

    Written on July 7th, 2010
    Categories: Gavit, My projects, UDK
    Tags:

    GViz features: Image based lighting

    (This series of articles is about the capabilities of GViz, a machinima toolkit for UDK.)

    After last weeks cubemap reflections I’d like to show you one more thing captured cubemaps can be used for: image based lighting.

    We can illuminate the scene with an image, an emissive texture which is in this case a cubemap. The CM was captured so it contains the look of the distant environment or skybox. Using that color information we can compliment the effect of direct lights and end up with more natural shading.

    Here is an example scene with a static mesh and a dynamic skeletal mesh, using only a single DominantDirectionalLight:

    Direct lighting only

    The shadows are articulated but way too deep. The main light direction and color is okay but beyond that there is little visual relation to this environment:

    Part of the cubemap showing the environment

    This captured environment cubemap is projected onto an inside-out sphere. This “light sphere” encompasses the playable area but still located inside the LightmassImportanceVolume.

    Using the light sphere only the scene looks like this:

    Indirect (image) lighting only

    The environment’s contribution is obvious, but the lighting is very diffuse without distinct shadows. The skeletal mesh’s shadow is not consistent with the static ones.

    Now, let’s use both lighting methods:

    Combined direct and image based lighting

    We got proper shadows on both dynamic and static geometry and natural colors filling areas not directly lit by the distant light.

    The contrast, brightness and saturation of the environment texture can be adjusted for maximum control over the final look.

    Since it’s a relatively small sphere with a texture, it’s much faster to compute than including the skybox and all the related decoration meshes in the GI rendering.

    Written on June 23rd, 2010
    Categories: Gavit, My projects, UDK

    GViz features: Blurry cubemap reflections

    (This series of articles is about the capabilities of GViz, a machinima toolkit for UDK.)

    Having blurred cubemaps (CM) in Unreal is unfortunately not as straightforward as it should be, for several reasons:

    - Outside tools are required because sampling different MIPs of a texture is not possible.

    - The cubemap images which were generated by 3rd party tools might need to be rotated to work well in Unreal.

    - The input CM, which gets blurred, usually has no relation to the Unreal map where it’s used on. Making and maintaining map specific versions of most reflective materials would be a daunting task.

    Yes, learning and using CubeMapGen is not that difficult, the images can be rotated by an ImageMagick script afterwards, you can capture cubemaps of actual maps, export and convert them to a format CubeMapGen can load, blur them then bring everything back again, every time the map changes significantly.
    All that could be done but it’s a rigid, slow and tedious workflow, so I tried to come up with a better one.

    As it turns out, it is possible to produce a decent blur right in Unreal. Like this one:

    http://www.zspline.net/blog/wp-content/gallery/gavit/image359a.jpg

    The idea is to use a recursive method to blur the CM during a period of time (20-30 frames), thus distributing the strain on the system. When the blur is done then the generated CM can be saved or used as is without any additional cost.

    I made a special actor to automate the process: A cubemap capture point is located inside a StaticMesh component, which is an inside-out sphere (so the normals are facing toward the center).
    There is a blur shader applied to this sphere: it blurs a bit the referenced CM which happens to be the one which is generated by the very same SceneCapture actor.
    This means that in one frame it captures the surrounding sphere, the next frame the sphere’s shader gets updated and blurs stuff a bit. This change is captured in the next frame, then the updated cubemap is processed again and so on.

    There is a time limit set in the actor after which the related components are deactivated and removed from the scene. The generated cubemap stays in the memory so it can be saved as an “offline” asset.

    With the proper blur shader it’s easy to simulate multilayer reflections like this:

    http://www.zspline.net/blog/wp-content/gallery/gavit/image359b.jpg

    It’s one cubemap and not two LERPed together.

    The base cubemap might be an imported but can also be captured by a SceneCaptureCubeMapActor placed above the map. (I recommend setting it’s near plane so that it skips the actual map and only sees the really distant environment.)

    So the blurring workflow becomes like this:
    - Set blur parameters.
    - Start a PIE session and wait for a few seconds.
    - Close PIE and save the generated cubemap.

    Technically the blurring is a somewhat hacky process I admit, but the workflow the end user actually uses is almost as simple as it should be.

    I also wanted a more flexible and generalized way of dealing with reflections and captured cubemaps offered a solution for that as well.
    Now GViz has render target cubemaps called “Environment” and “EnvironmentBlurred”. They are located in a package and referenced by every material instance which supposed to reflect the environment.

    These CMs are dynamic so their content is regenerated every time a game starts on a map. The impact on the frame rate is barely visible and only lasts for a second, so it could work not just in machinimas but in actual games as well. (Just make sure no one sees reflective objects at the beginning of a session, but hey, that’s what loading screens are for. :)

    By using these cubemaps in the shaders one can prevent the proliferation of CMs and related material instances and can also be sure that reflections have at least a remote relation to the visuals of the actual map.

    So I set up this material:

    http://www.zspline.net/blog/wp-content/gallery/gavit/image359c.jpg

    and now I can forget about it, it will look right whatever I do to the skybox.

    Written on June 16th, 2010
    Categories: Gavit, My projects, UDK
    Tags:

    Unreal gameplay rendered in modo

    My current project needed a method for capturing in-game events for later use. Since the data was there I thought importing it to modo to reconstruct the scene should be straightforward. I made an importer, made a little map, captured my performance and rendered it in modo.


    Download low quality version (512×288@30fps, 173 Mb)
    Download high quality version (640×360@60fps, 462 Mb)

    The movement of the camera and the physics driven objects were sampled at 20 Hz.
    To keep the data output in check, triggers were used on the map to control which actors are captured, silencing irrelevant ones.

    The final animation is three different sessions merged together. (The blending between them is quite visible, I will need to come up with a better solution.)

    During import similar consecutive keyframes were dropped to further decrease the processed data. Still, after around 500 imported, processed and created key, modo’s memory consumption went through the roof (2.7+ Gb) so I wasn’t able to import the data all at once. I changed the script so it could continue from where it left off and I saved the scene and restarted modo between passes. (I did this 80 times with each import taking about 8 minutes.)

    One of the key features of the importer is the capability to reconstruct the scene using the same .FBX asset files which were imported to Unreal. The directory structure for those files mirrored the package structure created in Unreal. (Which is a good idea regardless.)

    Each visible object is an instance of an imported reference, so changes in content automatically update the scene. (The parent references are left at the origin but scaled down to infinitely small, so they don’t interfere with the scene.)

    Bone transformations can also be captured so the next version of the importer will probably support some kind of a virtual motion capture for the player character and other skeletal meshes.

    Written on March 29th, 2010
    Categories: Gavit, My projects, Scripts, UDK
    Tags:

    Status report

    I’ve finished my programming task on schedule, a standalone Lua application which provides utility functions for processing data coming from Unreal. (More on its features in a later article.)

    I also started making a custom animation tree and learned much about Unreal’s animation system in general. The animations will be outsourced, and since this part of the project is going to be the most expensive, I really need to get everything right on my end. I must ask for the right animations as I can’t afford redoing anims over and over again.

    Fortunately – if everything goes well – I’m going to get help from a technical animator with this whole animtree thing, so there is hope yet that it will be done on time/budget and at a high quality.

    Speaking of high quality, my beloved Dollhouse has ended. After 26 episodes split between two seasons, it was canceled. I’m not happy about it but it’s still better than overdoing something until it’s squeezed and disfigured but still sweats money. (I’m looking at you Stargate… )

    Fortunately my sci-fi needs are still well fed: Mass Effect 2 is simply awesome.
    Fun to play, looks nice, runs at 60 fps, has great music and last but not least, the story is interesting. I though as much after playing ME1, so I stopped reading any kind of news about ME2 to avoid the marketing machine and similarly retarded forum users spoiling the story for me.
    Same goes for Bioshock 2 and any game from Bethesda Softworks. This article on Kotaku is about this is issue, and I totally agree with the author.
    I mean, it’s really shocking when Shepard discovers that she has a Geth twin sister, but it just wouldn’t have the same impact if you knew about it beforehand.
    Oh..erhm… oops…

    Written on February 6th, 2010
    Categories: Games, TV shows, UDK
    Tags:

    Virtual Oslo

    An acquaintance of mine, Sahak, found me with an interesting challenge: he wanted me to get his “Virtual city of Oslo” map to a presentable form.

    He imported simple buildings from City Engine to UDK and made a map of the city.
    Problems with the City Engine -> Unreal Engine asset pipeline and the sheer scope of the project led to an interesting task specification:

    - The city barely fits Unreal’s “world”, which is a roughly 10×10 km area.

    - 4188 unique buildings made up the city. No instancing at all. Each building had its pivot at the world origin.

    - No textures or proper UVs.

    - I had 48 hours to finish.

    After the two days, I came up with this:

    Virtual Oslo flythrough.
    (HD version on Vimeo.)

    The more technical, “behind the scenes” stuff is after the break.

    Read the rest of this entry »

    Written on January 30th, 2010
    Categories: My projects, UDK

    Cubemap rendering rig in modo 401 for Unreal

    Here is a scene file which makes cubemap generation (for Unreal) simpler:
    CubemapRenderRig.lxo

    Just import it to any scene and render the first 6 frames from the CubemapRenderCam camera. The frames should be added in the same order to the Cubemap in UnrealEd.

    There is a sphere object as well, around the camera, which blurs the surroundings. The RefractionRoughness parameter in the BlurMaterial group adjusts blurriness.
    (At first I tried camera DOF, but that way there were seams between the cubemap’s faces.)

    Written on January 14th, 2010
    Categories: UDK
    Tags: , ,