Horde3D
http://horde3d.org/forums/

Geometry Class support for Shadow Map?
http://horde3d.org/forums/viewtopic.php?f=2&t=2322
Page 1 of 1

Author:  kjCAE [ 20.10.2019, 16:18 ]
Post subject:  Geometry Class support for Shadow Map?

Hi,

First of all, thanks for adding OpenGL 4 support to Horde3D! It is really a pleasure to work with such a so lightweight 3D engine.

I have a question regarding shadow mapping.
Is there any reason why "Classes" are not supported when doing "DoDeferredLightLoop" in a pipeline?

I setup my pipeline using classes and make manipulation on the scene by switching classes between the different models according the user needs.
The problem is when I want to implement lighting and and shadowing, I cannot define which classes can contribute to shadow whereas lighting does due to G-Buffer use. By default, all classes contribute to shadow! How to avoid that?

Thanks.

Author:  Irdis [ 20.10.2019, 21:22 ]
Post subject:  Re: Geometry Class support for Shadow Map?

Hello.

DoDeferredLightLoop is rendering the light shapes like point and cone, and scene geometry is drawn before, on geometry pass. Therefore, there is no much sense in adding classes to this pipeline function.

As far as I understand, you wish to disable shadows for some groups of objects. You can do it in several ways. First, you can disable shadow casting of the specific light by disabling shadow maps:
Code:
h3dSetNodeParamI( lightNode, H3DLightNode::ShadowMapCountI, 0 );


Then, you can disable the specific node shadow casting:
Code:
h3dSetNodeFlags( meshNode, H3DNodeFlags::NoCastShadow, applyToChildNodes );


The third way is to make another call of DoDeferredLightLoop with noShadows parameter enabled for specific nodes with different shader context. Unfortunately, it seems that currently there is no way to use material classes for the case that you need...

Author:  kjCAE [ 21.10.2019, 09:09 ]
Post subject:  Re: Geometry Class support for Shadow Map?

Hi,

To be honest, when looking the code and based on the theory, to generate the shadow map, you need to render the scene from the light's point of view. Whatever if you use forward lighting or deffered.

In Horde3D, the following method is used for forward lighting:
Code:
void Renderer::drawLightGeometry( const string &shaderContext, const string &theClass,
                                  bool noShadows, RenderingOrder::List order, int occSet )

this one for deffered lighting:
Code:
void Renderer::drawLightShapes( const string &shaderContext, bool noShadows, int occSet )

but in both of them, the following method is used to generate shadow map:
Code:
void Renderer::updateShadowMap();

which calls:
Code:
drawRenderables( _curLight->_shadowContext, "", false, &frustum, 0x0, RenderingOrder::None, -1 );

also, default "" class means all geometry, and no order.

I did a try by changing by updating the method:
Code:
void Renderer::updateShadowMap(const string &theClass, RenderingOrder::List order)

and in the pipeline :
Quote:
<DoDeferredLightLoop class="TheClass"/>

it works perfect. (in my case :wink: )

What do you think?

Author:  Irdis [ 21.10.2019, 10:12 ]
Post subject:  Re: Geometry Class support for Shadow Map?

Hmm, well, if it works then it is good :)
But probably in case of DoDeferredLightLoop the "class" should be renamed to something like "enableShadowsForClass" (or maybe something better :) )because it is only related to shadows (in case of forward lighting it is also used to discard geometry that is not of the selected class).

I think you can pull request the change to horde's repository.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/