|
Re: Projective Texture Mapping - Spotlight Flashl
[Re: Scorpion]
#181163
02/20/08 04:00
02/20/08 04:00
|
Joined: Jun 2005
Posts: 656
Grafton
OP
User
|
OP
User
Joined: Jun 2005
Posts: 656
|
Quote:
what would be a good addition for realistic purpose:
get the dot product of the model normal and the normal from vertex to cam position and then use it with the "alpha" of the projection. So that only faces facing the light get lighted.
The shaders provided already do this. Only forward (light source) facing polygons are lit.
Adding more dynamic lights is simple, but many lights will require more than one pass which would slow the shaders down. Plus, if you wanted all lights to cast shadows, you will need a very high end graphics card. The game I created the flashlight shaders for features a shader that also supports a dynamic light that casts shadows (a "horror house" dynamic strobe light). I used light mapping for all else. You could create a shader which supports 2 projections without shadows and 3 lights with shadows or whatever you wish. There are numerous combinations you can create. Hopefully the examples should get you started.
|
|
|
Re: Projective Texture Mapping - Spotlight Flashl
[Re: Grafton]
#181164
02/20/08 04:37
02/20/08 04:37
|
Joined: Jun 2005
Posts: 656
Grafton
OP
User
|
OP
User
Joined: Jun 2005
Posts: 656
|
About the troubles in conversions. The simple per pixel spotlight shader setup can easily be converted to c-script. However, shadow mapping and projective texturing both rely on the use of a material assigned to a view. As far as I know, this is currently only availible when using lite-c.
Not two, not one.
|
|
|
Re: Projective Texture Mapping - Spotlight Flashl
[Re: Helghast]
#181165
02/20/08 11:38
02/20/08 11:38
|
Joined: Jan 2004
Posts: 3,023 The Netherlands
Helghast
Expert
|
Expert
Joined: Jan 2004
Posts: 3,023
The Netherlands
|
Quote:
in the meantime im wondering, how can i change the colour of the shadow pixel?
anybody, i really wanna know this!!
regards,
|
|
|
Re: Projective Texture Mapping - Spotlight Flashl
[Re: Helghast]
#181166
02/24/08 13:55
02/24/08 13:55
|
Joined: Nov 2007
Posts: 1,032 Croatia
croman
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,032
Croatia
|
hi, great contribution from you grafton, thanks.
check your pm's
Ubi bene, ibi Patria.
|
|
|
Re: Projective Texture Mapping - transfer2texture?
[Re: Grafton]
#181167
03/17/08 14:13
03/17/08 14:13
|
Joined: Jul 2005
Posts: 27
andibeh
Newbie
|
Newbie
Joined: Jul 2005
Posts: 27
|
Maybe it is a super stupid question, but would it be possible to transfer the projected texture permanently to the texture of the hit model? I would need that for a scientific simulation where I need to "print" several copies of a texture onto a model.
Last edited by andibeh; 03/17/08 14:14.
|
|
|
Re: Projective Texture Mapping
[Re: Ilidrake]
#206158
05/11/08 17:17
05/11/08 17:17
|
Joined: Jun 2005
Posts: 656
Grafton
OP
User
|
OP
User
Joined: Jun 2005
Posts: 656
|
I am not sure what you mean. In the demos, use the left/right cursor keys to pan the spotlight and the up/down cursor keys to tilt the spotlight. The W/S keys move it forwards and backwards. It can be positioned anywhere pointing in any direction. The purpose of these demos is to present the shaders to create spotlights, flashlights and projective texturing with/without shadow and normal mapping for general purposes. For a specific use, you will need to supply your own movement/placement code. For instance, if you want to make a flashlight that follows your camera, then each frame you need to do something like this;
vec_set(temp_vec, vector(10,-10,-10)); // create a vector vec_rotate (temp_vec, camera.pan); // rotate the vector to the cameras pan vec_add (temp_vec, camera.x); // position the vector at the camera vec_set(flashlight_mdl.x, temp_vec); // position your flashlight model vec_set(flashlight_mdl.pan, camera.pan);
Then send the position of the flashlight model to your shader.
Not two, not one.
|
|
|
|