maciek.mostowski Posted November 14, 2013 Posted November 14, 2013 Hi, I'm new to unigine and i have a question: Method void RenderLights::render_shadow_world(LightWorld *light,Vector<ObjectSurface*> *surfaces) is used to create shadow maps for the world light ( sun, moon ). From what ive understood we obtain 2 buffers : depth texture and color texture for world light and later on these texture are used in fragment_light_world.shader (SHADOW_WORLD_VERTEX_PCF) Question 1: How and when these texture samplers are passed to that fragment shader? What i need to do is to do is to render the scene from the world light source and write for each visible point its normal, color (reflectance diffuse coefficient ) and depth in order to obtain reflective shadow map. Im new to unigine and any help could be useful. Thanks,
maciek.mostowski Posted November 15, 2013 Author Posted November 15, 2013 <p>Ive found setTexture(int shader,int num,Texture *texture) which binds texture to shaders. </p> <p>I have a diffrent question about deffered shading. Where the information of the position is stored?</p> <p>In the structure </p> <div>struct RenderDeferred {</div> <div>Texture *depth_texture;</div> <div>Texture *color_texture;</div> <div>Texture *normal_texture;</div> <div>Texture *parallax_texture;</div> <div>Texture *ambient_texture;</div> <div>Texture *light_texture;</div> <div>TextureRender *texturerender;</div> <div>};</div> <div>i dont see it.</div> <div>Is computed from depth and viewport transformation somewhere?</div> <div>Thanks,</div>
unclebob Posted November 18, 2013 Posted November 18, 2013 Hi Maciek, Sorrry for late reply. Hope you'll be happy with the answers. :) Answer 1: Depth & Color light textures are used in RenderLights::render_light_receive_surfaces method, here's call sequence: RenderRenderer::render_world() -> shadow pass (rendering color & depth light textures) -> ... -> opaque objects pass -> RenderRenderer::render_scene_opacity() -> ... -> RenderLights::render_light_receive_surfaces() (using color & depth light textures) So basically, if you want to render additional textures, you should do that in shadow pass and use that textures in render_light_receive_surfaces. You'll need to update shaders as well. Answer 2: There's no position information stored in RenderDeferred. You're right, it's calculated from depth texture & viewport transformation in shader.
Recommended Posts