Search the Community
Showing results for tags 'glass'.
-
I want to know what is the purpose of this Glass refraction texture. which is connected to shader. How is it created. and why does it not look like a normal shader texture of unigine and looks more like alpha or ambient occlusion Map. Please let me know which software was used to create this texture map and how to recreate it, if that information is available to be disclosed.
-
To create glass that is both transparent and refractive, one glass surface is not enough. Our artists recommend to use two surfaces: The first surface is used to render reflected light. That is, diffuse and specular (reflective) highlights. The second surface is used to render refraction. That is, how transparent or dark the glass is. Such approach is better than using only one glass surface, as this way the glass surface itself is not distorted by the refraction. It is also used to create proper colored glass without lightening/bleaching diffuse colors, which is the case if one glass surface is used (since dual source blending is not available in DirectX 9). Another tip is related to proper sorting of transparent objects. In Unigine sorting is done per surface (depending on its bound volume). For transparent objects to be be sorted, split transparent objects into small surfaces when exporting an object. The smaller surfaces are, the better they are culled and sorted. Step 1. Create Glass Mesh After you've created a mesh for a glass surface: If necessary, split the glass objects into smaller ones. Clone the glass surface. Name one object *_reflection and another *_refraction. Vertices of these objects should fully match; it is necessary for surfaces to be depth-sorted in Unigine without visual artifacts. Plus these two surfaces should be exported as ONE mesh to avoid any flickering issues. Export a mesh from a 3D editor. In 3ds Max, cloned objects have issues with vertex precision (which may lead to flickering), that is why in the Exporter it is necessary to set Precision to 3-4 (limit floats). Step 2. Set Up Refractive Surface Open the Materials panel and inherit a new material from mesh_reflection_fresnel_base. Assign textures on the Textures tab. As you see there is no Alpha here. Transparency of the glass will be only defines in RGB components: the brighter the pixel is, the more transparent the glass. The darker it is, the less transparent the glass is. Set alpha blending: Src to zero, Dest to src color. That would make the scene behind the glass colored. That means, the screen buffer color (objects behind the glass) is multiplied by the glass color. No glass diffuse color is added (it is zero). Such blending will darken the objects behind the glass as they should be. Go to States tab and set the Ambient pass to transparent (in this mode, the glass diffuse color is not multiplied by the ambient lighting). Set Refraction to Default, so that refraction is rendered. Set all light passes (Light world, Light omni, etc) to Skip, as this surface is purely for rendering refraction. If necessary, set any Detail option (an overlay or multiply mode) to add unique bumps to the glass surface. On the Common tab, uncheck Parallax mask for objects with parallax mapping behind the glass to be rendered correctly. Uncheck Glow mask. Go to the Parameters tab and set Fresnel bias to 0 (not to compensate for the Fresnel effect). This way, when the camera looks on the glass up front, it will be transparent. Move the camera to look at the glass from a side and set up Fresnel power so that the glass looks dark/non-transparent. Set up Parameters -> Refraction. Step 3. Set Up Reflective Surface On the Materials panel inherit a new material from mesh_reflection_cube_base Assign textures on the Textures tab. For this material, we will set blending to lighten the glass surface. That means, dark pixels will not affect the final image, while white pixels will make the glass surface look whiter, as if covered or sprayed with something. For example, it make the glass look dusty or smudged. Set alpha blending: Src to one, Dest to one. This means, glass diffuse color and the colors of the scene behind the glass are added together. Check a Post refraction flag for glass surface itself not to be distorted by refraction. Leave the ambient and all light passes checked (they will be used to create reflections) On the Common tab, uncheck Parallax mask. Uncheck Glow mask if objects behind the glass need to be rendered with glow. If the glass itself should be glowing (for example, at night), leave this option checked. For shadows cast on the glass surface to be more visible, increase Diffuse scale. Make sure that you do not use a dark diffuse color, as in this case shadows cast on the glass will not be visible at all. Set up reflections (dynamic or static ones). Parameters->Reflection->Normal slider controls how the glass' normal map distorts the reflection. Step 4. Glass and Sky (Light Scattering) If the camera will view the sky through the glass, for both materials check Common -> Post Scattering flag. If the camera will view the glass from the far distance, such glass needs to be affected by light scattering. That is, Post scattering needs to be unchecked. Create a distant glass LOD, inherit materials from the created ones and uncheck this flag for both. Step 5. Shadows If the glass is transparent: Uncheck Cast shadows for both materials. For the reflective surface material, check Receive shadow. Step 6. Colored Shadows To enable colored shadows: For the refractive surface material, check Common -> Cast translucent. Enable rendering of translucence: Esc to open the Main menu -> Render tab -> Options -> Translucence. Enable casting translucent shadows from a world light source: Nodes -> LightWorld -> Shadow tab -> Translucence. Select the translucent shadow map size in the Translucence size drop-down list. If necessary, adjust translucence Bias. Step 7. Set Up Sorting of Transparent Surfaces If splitting glass into small surfaces did not help, you can manually set the sorting order: Materials -> Common tab -> Render order. The higher the value, the later the surface will be rendered if compared to other transparent objects. Render order: default Render order +1: Render order -1: