|
Re: Projective Texture Mapping - Spotlight Flashlight
[Re: Nidhogg]
#181143
02/01/08 05:50
02/01/08 05:50
|
Joined: Aug 2005
Posts: 390 Florida
oldschoolj
Senior Member
|
Senior Member
Joined: Aug 2005
Posts: 390
Florida
|
wow, because of you I now have projectors for my spell casting. You have helped me solve a long time problem, and saved me a good amount of money.
Thankyou.
you can find me with my face in the keyboard, unshaven, listening to some nameless techno tragedy, and hashing through code over a cold cup a stale joe.
__________________________________
yours truly
|
|
|
Re: Projective Texture Mapping - Spotlight Flashlight
[Re: oldschoolj]
#181144
02/01/08 09:31
02/01/08 09:31
|
Joined: Apr 2005
Posts: 4,506 Germany
fogman
Expert
|
Expert
Joined: Apr 2005
Posts: 4,506
Germany
|
You are our hero! I´ll send you some screens.
no science involved
|
|
|
Re: Projective Texture Mapping - Spotlight Flashl
[Re: fogman]
#181145
02/01/08 12:52
02/01/08 12:52
|
Joined: Jan 2004
Posts: 3,023 The Netherlands
Helghast
Expert
|
Expert
Joined: Jan 2004
Posts: 3,023
The Netherlands
|
this is great! question though... the projection works great and all, no probs there, but shadows dont seem to be working on this pc (work computer) though on my laptop (which specs are WAAAAAAAAAAAAY lower) it runs fine, any idea why they dont show up ?
(im using example 7. PT Spotlight with Shadow Mapping)
specs (of both machines) are:
Work PC: win XP SP2 intel core 2 extreme (quadcore) 3.0 GHZ 4 gig Ram ATI radeon 8800GTX 768MB
Laptop win XP SP2 dual core (not a core 2 duo) 1.7 GHZ 1 gig Ram ATI x1600 256MB
as you can see, both should work fine, i wouldnt have been surprised if thee laptop wouldnt work, but the monster-pc doesnt work... that's weird!
got any idea how to fix this (might be the 1024x1024 render target? how do we make that smaller if needed, so it's 24bit instead of 32bit).
regards,
|
|
|
Re: Projective Texture Mapping - Spotlight Flashl
[Re: Emre]
#181146
02/01/08 19:46
02/01/08 19:46
|
Joined: Jun 2005
Posts: 656
Grafton
OP
User
|
OP
User
Joined: Jun 2005
Posts: 656
|
I made a mistake, when looking at the version of A7 I using, I looked at about in SED 7.06, instead of WED 7.07. Sorry about the confusion. Ello: This is the same as in the demo, except a few shaders were mistakenly set to be compiled as VS 2.0 instead of 1.1. Emre: If you can not use Lite-c's "matViewProj", you can create this yourself like this. Code:
//REPLACE THIS LINE mat_set(mtlSpotlit.matrix,matViewProj); // store the transformation matrix to the material //WITH THIS CODE float my_matVP[16] = { 0.0, 0.0, 0.0, 0.0, 0.0,0.0,0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; mat_set(my_matVP,matView); mat_multiply(my_matVP,matProj); mat_set(mtlSpotlit.matrix,my_matVP);
Otherwise, it would be very hard to write this in C-Script (I know I said you could), because c-script dosent support materials for views. Helghast: Yeah that is strange! To try a smaller resolution shadowmap, just change bmap = "#1024x1024x14"; to bmap = "#512x512x14"; or bmap = "#256x256x14";
|
|
|
Re: Projective Texture Mapping - Spotlight Flashl
[Re: Grafton]
#181147
02/01/08 20:24
02/01/08 20:24
|
Joined: May 2007
Posts: 7
Reigel_Seven
Newbie
|
Newbie
Joined: May 2007
Posts: 7
|
Grafton, this is so freaking awesome of you! THANKS! I was able to convert the pixel shader examples to C-Script format, but I can't figure out a couple of things with the projection shader ones.
Could anyone help me convert this code to C-Script (wdl)? I've done most of it but I'm not sure how to change these lines:
function mtlProjection_event() // adjust matrices to size of bitmaps and pass to "matMtl" and "matEffect" { // create a transformation matrix float pTexAdj[16] = { 0.5, 0.0, 0.0, 0.0, 0.0,-0.5, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 }; // Adjust projection matrix for texture size pTexAdj[12] = 0.5 + (0.5/(float)bmap_width(projectiontex));// store bitmap diminsions into matrix pTexAdj[13] = 0.5 + (0.5/(float)bmap_height(projectiontex)); // Store the transformation matrix to the materials then adjust the matrix with the bitmap size mat_set(mtlSpotlit.matrix,matViewProj); // store the transformation matrix to the material mat_multiply(mtlSpotlit.matrix,pTexAdj); // adjust the matrix with the bitmap size }
.......
function init_stages() { ProjectionView.stage = camera; // so projection is not lagging one frame behind }
.......
As far as I can tell, these lines are the only thing that needs to be changed. I don't really know much about shader programming, otherwise I'd be able to do it myself. If someone could help me I'd be extremely grateful.
Thanks in advance!
|
|
|
Re: Projective Texture Mapping - Spotlight Flashl
[Re: Loopix]
#181150
02/02/08 11:09
02/02/08 11:09
|
Joined: Jul 2001
Posts: 6,904
HeelX
Senior Expert
|
Senior Expert
Joined: Jul 2001
Posts: 6,904
|
Thanks for your work.. this is awesome! I have some questions, though: - does the shader work for multiple projectors, too?
- this is a perspective projector.. are you able to make an orthograpic projector as well?
Thanks for your work!!
|
|
|
Re: Projective Texture Mapping - Spotlight Flashl
[Re: Grafton]
#181151
02/02/08 12:45
02/02/08 12:45
|
Joined: Jan 2004
Posts: 3,023 The Netherlands
Helghast
Expert
|
Expert
Joined: Jan 2004
Posts: 3,023
The Netherlands
|
cool, i'll try that when i get back to work ^_^ in the meantime im wondering, how can i change the colour of the shadow pixel? (im on my laptop, which has shadows working, so i can develop a bit here ) I did find how i could change the environmental fog to be more dense etc, but not the shadow color... then again im a complete shader noob, and never worked in lite-c yet :O but this is so gonna get me started!! again, thanks regards,
|
|
|
Re: Projective Texture Mapping - Spotlight Flashl
[Re: Helghast]
#181152
02/03/08 16:42
02/03/08 16:42
|
Joined: Mar 2006
Posts: 2,758 Antwerp,Belgium
frazzle
Expert
|
Expert
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
|
Tested it, it works great Cheers Frazzle
Antec® Case Intel® X58 Chipset Intel® i7 975 Quad Core 8 GB RAM DDR3 SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB NVIDIA® GeForce GTX 295 Memory 1795GB
|
|
|
|