source: GTP/trunk/App/Demos/Illum/IBRBillboardCloudTrees/OGRE/IBRTreesOGRE/media/oldgeneral/help_shadow_mapping.txt @ 1493

Revision 1493, 7.0 KB checked in by igarcia, 18 years ago (diff)
Line 
1<kandhalt> Hi everybody!
2<fp12> wow, I convert my file to have CR and it doesn't find my materials anymore...
3<kandhalt> I have some questions about shadow techniques in ogre3d
4<Sinbad> download for release build on Windows you get CRLF, download on Linux/OSX for release build and you get CR
5<kandhalt> I have different kind of objects in ogre3D
6<kandhalt> I have trees for example
7<kandhalt> the leaves are semitransparent planes
8<kandhalt> and the trunk a simple trunk mesh
9<Sinbad> kandhalt: texture shadows can deal with alpha, stencil shadows cannot
10<kandhalt> my question is that I want to use different  custom shaders in order to compute
11<kandhalt> the shadows for each kind of object
12<kandhalt> the problem that I see is that if I use the call setShadowTextureCasterMaterial
13<kandhalt> ALL the objects will use the same technique
14<Phantom-> Sinbad: I am wondering about the skybox orientation argument... Why isn't just the skybox scenenode rotated? at the moment all the six planes are rotated according to the orientation quaternion...
15<kandhalt> Sinbad: the problem is that I'm using a special kind of billboard clouds for the tree leaves
16<kandhalt> and I apply a different approach in order to have high resolution impostors in the shader
17<kandhalt> so the shader code is not the same that I use for generate the shadow of the trunk
18<kandhalt> that's why I ask if there is a way to specify different shadow techniques for each object
19<kandhalt> all of them will be texture shadows of course
20<kandhalt> but with some differences in the shader code
21<Soulim> Somebody said something like RenderToTexture? What is the function for that?
22<P__> Phantom-, skybox has no scenenode, or i'm wrong ?
23<Sinbad> kandhalt: you can set a shadow caster vertex shader per pass
24<-- DWORD se ha marchado (Read error: 110 (Connection timed out))
25<Sinbad> http://www.ogre3d.org/docs/manual/manual_20.html#SEC85
26<kandhalt> Sinbad, yes I know. but
27<kandhalt> for example
28<P__> Soulim, you can look at the RenderToTexture demo
29<Phantom-> P__: yes it has, I tried modifying the code to just rotating the scenenode
30<kandhalt> if I set the vertex shader code <---> for the shadow of the leaves
31<Soulim> P__ - oh yes, the ogre examples
32<P__> Phantom-, ok
33<-- dogzr se ha marchado ()
34<kandhalt> then this code won't be de one that I want to exec for generating the shadows of the trunk
35<Sinbad> Phantom-: can't remember - but it's the same thing ;)
36<kandhalt> I have different shaders
37<Sinbad> kandhalt: I know
38<kandhalt> Sinbad: what I mean is that if I set a material with this vertex shader for the shadow_map pass
39<-- Siroro se ha marchado (Read error: 110 (Connection timed out))
40<kandhalt> I can't have the other vertex shader for the other kind of object
41<Sinbad> hence why I said you can set a shadow vertex shader for each pass, per material thus have a different one for the trunk and the leaves
42<kandhalt> mmm... but I thought
43<Phantom-> Sinbad: yea I know it should be, but somehow when rotating with the current version, the planes of the skybox get dragged further and further appart from eachother... it's hard to explain. Changing ogres code to use the scenenode orientation fixed this
44<Phantom-> no idea why
45<-- Soulim se ha marchado ("Zzz")
46<kandhalt> that if I use a custom technique for the shadow mapping I have to define the
47<kandhalt> setShadowTextureCastMaterial
48<kandhalt> WITH the material that has the custom shadow vertex shader
49<kandhalt> isn't it?
50<Sinbad> you didn't read the notes in the API
51<Sinbad> Individual objects may also override the vertex program in
52<Sinbad> your default material if their materials include
53<P__> good night
54<Sinbad> shadow_caster_vertex_program_ref shadow_receiver_vertex_program_ref
55<-- P__ se ha marchado ("Leaving")
56<Sinbad> entries, so if you use both make sure they are compatible.
57<Sinbad> thats in the setShadowTextureCasterMaterial API description
58<Sinbad> Phantom-: odd, well submit it as a patch then please :)
59<Phantom-> Sinbad: On my way. But first I will make a few more test to see if I am not doing something horribly wrong :)
60<Sinbad> hehe, always a good idea
61<kandhalt> Sinbad, ok I see. Everyobject can override  the vertex_program for the shadow_maps, so in the object material pass I will have two passes, one with the shadow_caster_vertex_program_ref, and a second pass with my rendering conf to draw the object?
62<kandhalt>  (so in the object material I will have two passes, one with the shadow_caster_vertex_program_ref, and a second pass with my rendering conf to draw the object?)
63<Sinbad> nono
64<Sinbad> the material for rendering to the screen is completely separate from the material used to render to the shadow texture
65<kandhalt> yes that's what I was trying to explain
66<kandhalt> at first
67<kandhalt> but
68<kandhalt> this separate material
69<kandhalt> must be the same for every object that will be a shadow caster?
70<kandhalt> (sorry for my bad english)
71<Sinbad> ah, I see where you're coming from
72<kandhalt> :)
73--> efkoj (i=efkoj@d5152052A.access.telenet.be) ha entrado en #ogre3d
74<Sinbad> ok, I guess this can look a little odd
75<efkoj> hello guys
76<Sinbad> but, the shadow_caster_vertex_program_ref is really just providing a linkage from the material used to render to the screen, to the material used to render the shadow texture
77<Sinbad> the latter is entirely created by OGRE, it isn't your material
78<Sinbad> but you can influence it
79<Sinbad> by telling it what vertex program to use when it renders an object that would otherwise be using your material
80<Sinbad> so, the shadow vertex program ref goes in your normal pass definition
81<Sinbad> and it won't ever get used in normal screen rendering
82<kandhalt> aaaaah
83<Sinbad> but will affect how the object is rendered to the shadow
84<kandhalt> now I understand
85<kandhalt> ok
86<kandhalt> nice
87<kandhalt> I thought that I should define the shadow_caster_vertex_program in the shadow caster material
88<kandhalt> ok
89<kandhalt> I can define this shadow_caster_vertex_program in each different kind of object material and
90<Sinbad> nope, you've got a global shadow caster material you can set, and then a vertex program that can be plugged into it per original material pass
91<kandhalt> will be sticked to the shadow_caster material
92<Sinbad> yes
93<Sinbad> which can either be the OGRE-created one or your custom one
94<kandhalt> nice
95<kandhalt> perfect
96<Sinbad> that's why the API makes a point about needing to make them compatible
97<kandhalt> that is not a problem ;)
98<Sinbad> cool
99<kandhalt> thanks
100<kandhalt> now I fully understand how it works
101<Sinbad> np - it was originally created to deal with hardware skinning but clearly works for any custom shaders
102<kandhalt> yes I'm using it in fact
103<kandhalt> but until today with only one kind of shadow caster objects
104<kandhalt> now I understand how to use it in general
105<kandhalt> thanks
106<Sinbad> you're welcome
107<kandhalt> It's noticeable that you played alot with this shadowing interface it's flexible
108<Sinbad> it caused me some serious headaches to deal with all the variations, but it got there in the end :)
Note: See TracBrowser for help on using the repository browser.