How to use/create 3d imposter sprites? (4.3)
The 4.3 release introduced a lot of exciting new tech. I'm pretty excited to start using imposters, and see what kind of performance gains we can get from using them. Are there any tutorials, documentation, examples of creating and implementing imposters? I've discovered the imposter Material Function and Blueprint in the Art Tools package, but have failed miserably at setting up anything successfully. I have rendered out a sprite sheet with base color of a mesh using the new texture render Blueprint, but I'm not sure what to do next.
asked Jul 17 '14 at 07:34 PM in Using UE4
I have documentation written and submitted to some people to help clean it up for review. I will post it here for now. Sorry it should be up soon!
Basic Usage: The RenderToTexture Blueprint works by using a bare-bones GameMode setup. There is a companion asset called the RenderToTexture_Game which references the RenderToTexture_Pawn. The Pawn is a very basic blueprint that simply has a Camera Component set to orthographic and a few event graph nodes to setup the rendering console commands. The first step to using these tools is to create a new blank level and assign the RenderToTexture_GameMode as the GameMode in the World Settings:
Blueprint'/Engine/ArtTools/RenderToTexture/Blueprints/RenderToTexture_Game.RenderToTexture_Game' You must then Place the RenderToTexture_LevelBP into the level. It is located at: Blueprint'/Engine/ArtTools/RenderToTexture/Blueprints/RenderToTexture_LevelBP.RenderToTexture_LevelBP' This method currently saves .bmp format images. It is currently necessary to open and resave as .tga using an image processing tool. In practice that is not a big deal since in most cases you will want to render at a large res and downsample using an image processing pass later.
Note: In UE4.3, there is a minor bug with the blueprint that requires you to place it at world location 0,0,0. If it is moved outside of 0,0,0, the camera will not align properly with the target. You must also place a playerstart in the level that has 0 for all rotation values. Note: In 4.3 you must also go to Editor-> Preferences -> Play (or click the small down arrow next to the “Play” button and choose advanced settings). Then you must type in a size that is a power of 2 (or at least square if you are planning to downsample later) for the “New Window Size” setting. I suggest you use 512x512 to keep the window small as that will not affect quality.
The setting to choose which type of basic function will be performed is located under the ‘Default’ Group up top. Below you can see Property Groups for the various functions:
Here you can see the options for “Render Type” expanded. Which option is selected here determines which function gets performed and which settings below are relevant. The only Property Group besides Default that is relevant to all functions is the “Capture Settings” group. This group allows you to select which buffer targets you wish to save. For most cases BaseColor and Normal are sufficient. To render out opacity masks the “Decal Mask” option works well.
answered Jul 18 '14 at 04:52 PM
The resolution multiplier will multiply the settings you entered into the “New Window Size” in the Editor Preferences. So if you entered 512x512 , a multiplier of 2 would result in a 1024x1024 texture size. A multiplier of 4 would result in a 2048x2048 texture size. Depending on the desired results, you may want to render textures as high as 4096 or 8192 in order to downsample them in Adobe Photoshop. In those cases it is usually suggested that you add a post process volume and set the Anti Aliasing setting to “none” to get a more crisp result.
1) Render a Tiling material to textures Note: In UE4.3, this particular function is missing the setting to specify the material target. This is easily worked around by placing the following mesh at 0,0,0 in the world, and setting the Scale to match the number specified in “Sheet Size” on the Blueprint (Defaults to 1000): StaticMesh'/Engine/ArtTools/RenderToTexture/Meshes/S_1_Unit_Plane.S_1_Unit_Plane' Then simply apply the desired material and it will work. You must also enable the ability to export buffer visualization targets in the editor. That can be found by clicking the upper-left Down-Arrow button in the perspective viewport and selecting “High Resolution Screenshot”
That will bring up a small window of the same name. You must check the box named “Include Buffer Visualization Targets”
You must actually leave this window up. It is ok to just click anywhere on the editor again, this window will move behind the editor and should not interfere. If you accidentally close the window, the buffer images will not render. You will need this box checked and the window open for all of the render functions as well. Now the only remaining step is to Play the game in a new Window, press ~ or tab to bring up the console and type “rendertextures” and hit enter. You should get a popup message indicating that images were saved, the message is actually a clickable link to the folder location. If you are not able to click the link in time, you can find the saved textures here: \\YourProject\ Saved\Screenshots\Windows\
answered Jul 18 '14 at 04:54 PM
3) Render 3D imposter sprites Imposters are sprites that use flipbook style textures to store a view of a static mesh from every possible view - or at least the number of views you can comfortably fit onto your texture sheet. The result is a sprite that matches the original mesh very well in terms of the material and lighting; however, there will be some popping between frames. That means they are not perfect for all applications. When you need to render LOTS of objects that won't move slowly and closely past the camera, it can be very useful. Before you can create an imposter sprite, you need to bake out a series of imposter textures.
Imposter Static Mesh: This is the static mesh you want to make an imposter for.
Imposter Material Array: This is an array so that you can specify materials for each index for meshes that have more than one material ID.
Note: You need to apply a Tangent->World transform on the normalmap input for the materials in the imposter material array . The reason for that is we want to represent the world normal as viewed from the direction the camera would be, instead of all using the same camera which this top-down method forces. You can simple use 0,0,1 transformed Tangent->World if there is no normalmap texture.
Frames around Z: This setting determines how many frames around Z your imposter will store. Higher numbers result in less ‘popping’ in the final result during motion but will either cause less texture resolution or require you to use very larger texture sizes.
Mesh Scale: This allows you to scale down the mesh slightly if you have any issues with edge bleeding in the final imposter sprite material. This is only necessary in rare cases where the mesh very closely matches its sphere bounds causing the meshes to get close to the edge of each grid cell. Only adjust when necessary as the smaller the scale, the more resolution that is lost.
Aspect Ratio 1 by: This setting allows you to create nonuniform textures. At the default 1, the imposter grid will be square. If the setting is 2, the aspect ratio will be 2:1; if the setting is 4 it will be 4:1 etc. It is suggested to keep the aspect ratio square for “Full 3D Imposters” and to only modify it when “Single Rotation Axis” mode is used. Note: I only realized upon typing this doc how incorrect this setting name is. Expect a more friendly name for this setting soon.
Imposter Enum: This is a drop down that allows you to choose between two different types of Imposter baking: “Full 3D Imposters” and “Single Rotation” axis. Full 3D imposters get represented from all angles, including above and below. “Single Rotation Axis” only rotates the mesh around Z which is ideal for distant LOD for things that are grounded on the horizon such as Trees, large buildings or general skybox elements. Single Rotation axis allows for better use of texture memory as there aren’t as many necessary to store.
Single Rotation Axis rotation: This setting is a start rotation setting that is only used when the single rotation axis option is selected. It allows you to orient the mesh how you want relative to the camera.
After you have configured your imposter with the desired number of frames, rendering the imposter textures is just like the original “tiling material” step.
Select the desired buffer targets under “Capture Settings”; Make sure the “Include buffer visualization” button is checked and the “High resolution screenshot” window is open; Play the game in a New Window and type “rendertextures” at the console and hit enter.
Now you should have a series of rendered imposter images. To make use of these textures, you will need to create a material that uses the ImposterUVs material function:
This function sets up the UVs, Normals and WorldPositionOffset for your material. There are a few parameters you need to define to match your Imposter setup:
FramesX (S): This should be the number of frames on the X axis for your imposter. For example if you specified 16 rotations around Z there will be 16 frames on the X axis.
Frames Y (S): This should be the number of frames on the Y axis. For square aspect ratios this should always match the frame Y. If you entered an aspect ratio of 2:1, then the the Y frames would be half of the X frames.
Fixed Z (B): This is a Boolean option that should only be set to True when using an imposter with “Single Rotation Axis”. This makes the calculations much cheaper.
SpriteWidth (S): This is how wide your resulting sprite will be.
SpriteHeight (S): This is how Tall your resulting sprite will be.
Position (V3): Defaults to AbsoluteWorldPosition and should be left untouched in most cases. Can be used if you want to trick the function into displaying the imposter at a weird angle or if you want to use custom data to represent locations.
VertexShaderZrotation (S): This is a debug only setting. What this feature does is break up the sprite’s Z rotation into a set of discreet steps rather than smoothly interpolating across the entire range. This prevents popping from looking worse due to how imposters are baked. With smooth sprite interpolation the imposter appears to overshoot its rotation at each frame transition. This fixes that when the value equals 1. You can set to 0 to see what it looks like disabled. Mostly noticeable from above an imposter mesh.
Rotation (S): The imposter sprites can be rotated around the specified axis. This allows you to randomly rotate various copies of the same imposter sprite in the world so that they do not look the same.
Rotation Axis (V3): This setting is currently disabled. The rotation axis always defaults to 0,0,1 or around Z. There were some issues when trying to support any rotation axis but this support may be added in the future.
Normals (V3): This should be your normalmap texture. What this does is rotate the normal to match your specified Rotation value.
Hi Ryan, Are the procedural texture creator, Unwrap vertex setup, shadow projection tools. Also are imposter sprites able to cast shadows (dynamic of course as baked wouldn't work) if you capture the alpha of the 3d object in the bake then surly there is no reason baked shadow projections couldn't be done, Also can you do some explanation like you have above for these tools as well. Cheers Kingbadger3d
answered Jul 28 '14 at 12:49 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here