[osg-submissions] ShadowMap update
Mihai Radu
radu at cm-labs.com
Wed Oct 3 09:26:36 PDT 2007
Hi Robert,
The texture for the shadow map is being created after the first update
traversal of the technique, and I wanted to test if creating the slave
camera before that step has something to do with not getting a proper
display.
That's why I changed the location for the hud creation, while debugging
I could see that the texture used for the hud was an instatiated object.
I think the same result could be arrived at by using an update call-back.
The first thing to solve is why the depth map gets rendered in the hud
as a uniform black/grey color.
Cheers
Mihai
Robert Osfield wrote:
> HI Mihai,
>
> Thanks for the update. I've merged all the changes to ShadowMap.cpp.
> The change to the debug HUD I've haven't changed as it really isn't
> the right way to set up slave cameras - right there in the frame loop.
> Why did you make this change?
>
> Robert.
>
> On 10/3/07, Mihai Radu <radu at cm-labs.com> wrote:
>
>> Thank you Robert,
>>
>> After some more tweaking I found the error I made in dealing with
>> spot-lights, and it's working properly now. The _texGen was not being
>> updated for that case.
>>
>> I also changed the clamp parameters for _texture, so that if objects
>> fall outside of the map, they are not shadowed.
>>
>> This means that now ShadowMap can use any kind of light, directional,
>> point or spotLight.
>>
>> For future developments I could work on some more sophisticated shaders,
>> like per-pixel illumination, I wonder if there is a demand for that, or
>> if the shaders used in ShadowTechniques are meant to be very simple
>> implementations for illustration purposes.
>>
>> Cheers
>> Mihai
>>
>> Robert Osfield wrote:
>>
>>> Thanks Mihai,
>>>
>>> The changes fixes things at my end so the changes are now checked in.
>>>
>>> On 10/2/07, Mihai Radu <radu at cm-labs.com> wrote:
>>>
>>>
>>>> Hello Robert,
>>>>
>>>> I have fixed the issues you mentioned, for the shader the renaming of
>>>> the Uniform variables was not complete, and for the texture size, I
>>>> changed to osg::Vec2s to avoid conversion warnings (they were not
>>>> showing at all in VisualStudio 2005).
>>>>
>>>> Using osgshadow example the flag "--debugHUD" will enable the debug
>>>> display, even though right now it only displays white.
>>>> Using spotlights it's still not giving the right results, I am looking
>>>> into the reasons for that.
>>>>
>>>> Cheers
>>>> Mihai Radu
>>>>
>>>> Robert Osfield wrote:
>>>>
>>>>
>>>>> Hi Mahai,
>>>>>
>>>>> I've applied your change but get the follow errors when I run
>>>>>
>>>>> osgshadow cow.osg --base -sm
>>>>>
>>>>> FRAGMENT glCompileShader "" FAILED
>>>>> FRAGMENT Shader "" infolog:
>>>>> (8) : error C1008: undefined variable "ambientBias"
>>>>> (8) : error C1008: undefined variable "ambientBias"
>>>>>
>>>>> glLinkProgram "" FAILED
>>>>> Program "" infolog:
>>>>> Fragment info
>>>>> -------------
>>>>> (8) : error C1008: undefined variable "ambientBias"
>>>>> (8) : error C1008: undefined variable "ambientBias"
>>>>>
>>>>> There is also a white rectangle overlayed on the window, I presume
>>>>> this is your debug camera. This should not be there by default.
>>>>>
>>>>> On compile I also got the following warnings:
>>>>>
>>>>> /home/robert/OpenSceneGraph/src/osgShadow/ShadowMap.cpp: In member
>>>>> function 'virtual void osgShadow::ShadowMap::init()':
>>>>> /home/robert/OpenSceneGraph/src/osgShadow/ShadowMap.cpp:141: warning:
>>>>> converting to 'unsigned int' from 'float'
>>>>> /home/robert/OpenSceneGraph/src/osgShadow/ShadowMap.cpp:142: warning:
>>>>> converting to 'unsigned int' from 'float'
>>>>>
>>>>> Could you please fix these problems and resubmit as the changes aren't
>>>>> suitable for integration with 2.2 as they are.
>>>>>
>>>>> Robert.
>>>>>
>>>>> On 10/1/07, Mihai Radu <radu at cm-labs.com> wrote:
>>>>>
>>>>>
>>>>>
>>>>>> Hi Robert,
>>>>>>
>>>>>> I hope it's not to late to have some additions to ShadowMap included in
>>>>>> the 2.2 release.
>>>>>> CM-Labs will be using this as the basis for shadows in the osg 2.2 based
>>>>>> simulator, and it would help a lot to have some of these additions into
>>>>>> the main osg.
>>>>>> If the there is no quick fix for using spot-lights I can chop-out that
>>>>>> part of the code and re-post the files asap.
>>>>>>
>>>>>> Most of the additions are small utility methods:
>>>>>> - set the resolution of the shadow map; it calls dirty() to
>>>>>> re-initialize at next update
>>>>>> - keep a list of Shader objects to use instead of the default ones, if
>>>>>> the list is empty, the default shaders are used
>>>>>> - explicitly create the Uniform variables, so that subsequent additions
>>>>>> that require more Uniforms can put them in a central place
>>>>>> - set a Light or LightSource to use explicitly for shadow casting,
>>>>>> allows multiple lights in the scene, with one casting shadows
>>>>>>
>>>>>> There are two additions that do not ( yet ) function correctly, but in
>>>>>> the present usage they do not interfere with the regular usage of the
>>>>>> techique:
>>>>>> - support for using spotlights, it's using Light.spotCutoff to determine
>>>>>> if it's a spot-light and not point-light,
>>>>>> there is an error in the setup of either the shadow camera or the
>>>>>> texgen, most likely due to the direction of the spotlight, since the
>>>>>> position is being used just like in point or directional lights.
>>>>>> - creation of a debugHUD
>>>>>> the hud is created properly, ( the example included shows it ), but
>>>>>> it displays only white, there has been some discussion of displaying the
>>>>>> shadow map, but I could not find it, the addition of a simple fragment
>>>>>> shader with the appropriate color transform should get this going.
>>>>>>
>>>>>> Thank you for your patience
>>>>>> Mihai Radu
>>>>>>
>>>>>> _______________________________________________
>>>>>> osg-submissions mailing list
>>>>>> osg-submissions at lists.openscenegraph.org
>>>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> _______________________________________________
>>>>> osg-submissions mailing list
>>>>> osg-submissions at lists.openscenegraph.org
>>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>>>>>
>>>>>
>>>>>
>>>> _______________________________________________
>>>> osg-submissions mailing list
>>>> osg-submissions at lists.openscenegraph.org
>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>>>>
>>>>
>>>>
>>>>
>>>>
>>> _______________________________________________
>>> osg-submissions mailing list
>>> osg-submissions at lists.openscenegraph.org
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>>>
>>>
>> _______________________________________________
>> osg-submissions mailing list
>> osg-submissions at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>>
>>
>>
>>
> _______________________________________________
> osg-submissions mailing list
> osg-submissions at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
More information about the osg-submissions
mailing list