Skip to main content
GameDev.net gamedev.net
🔒 Locked

Projective Texturing Help

Started by Maverick_24 Dec 26, 2006 at 9:35 PM 7 replies 1.6k views
Original Post
Maverick_24
Maverick_24
Hey guys, I've been trying to get shadow-mapping going in my program and can't figure out how to do projective texturing. I've been looking around online and i think that what you do involves some math between the "projector" matrix and the "camera" matrix and apply that to the uv coordinates of the texture you want to project. This is probably wrong, but thats what i think i know so far. I guess in simplest terms i would like to be able to project a texture from directly above onto a flat plane on the ground. Any ideas guys, or any DirectX functions that might point me in the right direction? Thanks
dave
dave
Just to clarify, are you trying to do shadow mapping or something like projecting a torch onto the scene, like in Doom3?
Maverick_24
Maverick_24
I was originally trying to do shadow-mapping, but found out that projecting a texture created from the depth buffer from the lights point of view was how you did it...and i don't really know how to project textures....if this is wrong please let me know, or let me know i'm going at it in the wrong approach

thanks man

PS: i looked around for "decalling" too, is that the same thing?
dave
dave
Well for typical shadow mapping your first pass builds a depth texture and your second pass renders the scene and tests each pixels depth to that in the depth texture and then alters the pixel shaders output colour to be grey.

Dave
Maverick_24
Maverick_24
so shadow-mapping is not a fixed-function pipeline kind of thing?
dave
dave
No.
Maverick_24
Maverick_24
thanks, ok, so we have that down.....hmmmm, doing all this really got me thinking about projecting textures, so, forgetting about the whole shadow-mapping thing, i still want to be able to project a static image onto a flat plane....any advice?

I don't believe this is a shader only technique, but please let me know if it is

thanks
dave
dave
Projecting textures is done kinda similar.

Firstly the texture you are using must have atleast 1 pixel around its edge that is black. You set the texture sampling properties to CLAMP, this means that when you come to a pixel that would use a part of the texture that lies off the edge of the texture, it is not wrapped and you don't get your projected texture everywhere.

Transform the vertex position into the screen-space of the projector position, like you do for the light source in shadow mapping. Once this is done you simply sample the texture and blend the sampled colour with your output colour in the pixel shader.

Dave
Maverick_24
Maverick_24
hmmmmm, i'm still a little stumped here......anybody have any good insight for me? or words of wisdom?

I have been looking through this white paper:
http://www1.cs.columbia.edu/~ravir/6160/papers/shadow_mapping.pdf

I still feel like im missing something...

so i have an image or shadowmap i want to project onto a flat surface, how does the texture coordinates from the projector change into the coordinates that the camera sees?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.