Tutorial - Rendering A Shadow Map

jlv
Site Admin
Posts: 12314
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Tutorial - Rendering A Shadow Map

Postby jlv » Fri Feb 07, 2014 12:20 am

The FBO/TexSubImage message determined by the "Terrain Rendering Method" graphics setting. You want to use FBO's if you can, which is the Hardware/Direct setting.

If the track was created in the editor and you haven't changed the lighting settings, the only thing that should change is the shadows should show up. Are you sure the file is really a PGM? Some export filters will create a PPM file with a PGM extension. Try converting to greyscale before you export it.
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.

slowngreen
Posts: 904
Joined: Mon Sep 02, 2013 6:18 pm
Team: MotoPin Racing
Location: idaho

Re: Tutorial - Rendering A Shadow Map

Postby slowngreen » Sun Feb 09, 2014 2:27 am

Maybe its not working because Ive not done this part?

// SCALE x (RESOLUTION - 1) = LENGTH & WIDTH ---> EG. 1.6 x (1025-1) = 1638.4

I have no clue what to do there. The rest all checks out though.
Image

jlv
Site Admin
Posts: 12314
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Tutorial - Rendering A Shadow Map

Postby jlv » Sun Feb 09, 2014 3:10 am

If you get that wrong, the shadows will be in the wrong places. Sounds like you're not getting any shadows at all. Does the shadow map's dimensions match your terrain's dimensions?
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.

slowngreen
Posts: 904
Joined: Mon Sep 02, 2013 6:18 pm
Team: MotoPin Racing
Location: idaho

Re: Tutorial - Rendering A Shadow Map

Postby slowngreen » Sun Feb 09, 2014 3:39 am

Yep, resize it to 1025x1025 which is the same size. Im kind of at a loss on this one. Ive redone it three times, the shadow picture looks right (i think) but just will no show up even after the reshade. Might just give up on this one and try on my next track.
Image

slowngreen
Posts: 904
Joined: Mon Sep 02, 2013 6:18 pm
Team: MotoPin Racing
Location: idaho

Re: Tutorial - Rendering A Shadow Map

Postby slowngreen » Sun Feb 09, 2014 3:50 am

This pretty much looking the way it should prior to saving it as a pgm? If so, I open it in photoshop cs2, save as, shadow.pgm and select portable bit map which has pgm in parentheses.

Image
Image

User avatar
DJ99X
Posts: 15461
Joined: Tue Jan 15, 2008 11:36 am
Team: El Chupamobra
Location: Upper Shit Creek, Sans Paddlington

Re: Tutorial - Rendering A Shadow Map

Postby DJ99X » Sun Feb 09, 2014 4:17 am

I usually lighten it a bit so you can still see rut shadows

slowngreen
Posts: 904
Joined: Mon Sep 02, 2013 6:18 pm
Team: MotoPin Racing
Location: idaho

Re: Tutorial - Rendering A Shadow Map

Postby slowngreen » Sun Feb 09, 2014 7:49 pm

^^^wish that were a problem lol.
Image

jlv
Site Admin
Posts: 12314
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Tutorial - Rendering A Shadow Map

Postby jlv » Tue Feb 11, 2014 2:47 am

The image should be 1025x1025, not 1024x1024. It also needs to be greyscale rather than RGB or the export filter is likely to save it as a PPM instead of a PGM.
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.

slowngreen
Posts: 904
Joined: Mon Sep 02, 2013 6:18 pm
Team: MotoPin Racing
Location: idaho

Re: Tutorial - Rendering A Shadow Map

Postby slowngreen » Tue Feb 11, 2014 3:25 am

I am doing 1025x1025 for sure. Also just to double/triple check when I mouse over the shadow.pgm, it says "file type PGM".
Image

jlv
Site Admin
Posts: 12314
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Tutorial - Rendering A Shadow Map

Postby jlv » Wed Feb 12, 2014 3:05 am

Try opening it in a text editor and looking at the first few lines. For a 1025x1025 PGM file it should look like this:

P5
1025 1025
255

The garbled looking binary data after the header is normal.
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.

slowngreen
Posts: 904
Joined: Mon Sep 02, 2013 6:18 pm
Team: MotoPin Racing
Location: idaho

Re: Tutorial - Rendering A Shadow Map

Postby slowngreen » Wed Feb 12, 2014 6:06 pm

darn, one more thing that checks out fine.

P5
1025
1025
255
Image

barrington314
Posts: 6048
Joined: Fri Feb 18, 2011 6:03 pm
Team: me
Location: Charleston, SC

Re: Tutorial - Rendering A Shadow Map

Postby barrington314 » Wed Feb 12, 2014 6:12 pm

If you would like, upload what you have and PM it to me. Ill see if I can find the problem for you.

slowngreen
Posts: 904
Joined: Mon Sep 02, 2013 6:18 pm
Team: MotoPin Racing
Location: idaho

Re: Tutorial - Rendering A Shadow Map

Postby slowngreen » Wed Feb 12, 2014 6:16 pm

Yeah? thanks a ton man, I'll do it after a while.
Image

slowngreen
Posts: 904
Joined: Mon Sep 02, 2013 6:18 pm
Team: MotoPin Racing
Location: idaho

Re: Tutorial - Rendering A Shadow Map

Postby slowngreen » Thu Feb 13, 2014 12:26 am

JLV, barrington pointed out my problem. I wish I could find someone to blame it on :lol: but my file was named shadow.pgm instead of shadows.pgm. I fixed that and they showed up. Huge thanks for all the help.
Image

slowngreen
Posts: 904
Joined: Mon Sep 02, 2013 6:18 pm
Team: MotoPin Racing
Location: idaho

Re: Tutorial - Rendering A Shadow Map

Postby slowngreen » Sat Mar 29, 2014 9:39 pm

Having trouble again with this. Got my shadows rednered, resized, greyscaled and put back into my file but the I get this message at the top of the screen and the track wont load.
click pic to make it bigger if needed.
Image
Image


Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 1 guest