Tutorial - Rendering A Shadow Map

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

Re: Tutorial - Rendering A Shadow Map

Postby jlv » Sun Mar 30, 2014 3:07 am

What does your lighting file look like? The error means you probably have a space instead of an underscore in the "dynamic_lighting 1" line.
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 Mar 30, 2014 4:09 pm

Ah ok that fixed that part. The 2nd line is still showing up though and it wont open the track.

"Texture rendering with framebuffer objects"

When I had that problem before it was after the track was loaded but it wont load now.
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 Mar 30, 2014 6:03 pm

Nevermind I fixed it, I was resizing to 1025 when its a 2049.
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 Mar 30, 2014 6:29 pm

Hmmmm, one last problem. I cant get the shadows to line up at all? They are way off. Any ideas?
Image

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

Re: Tutorial - Rendering A Shadow Map

Postby jlv » Sun Mar 30, 2014 11:18 pm

You need to set the width and height variables to match the scale of your track.
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 » Mon Mar 31, 2014 1:46 am

Isnt that the 2049x2049? I did the math and put it in the right place, I thought?

#declare LENGTH =3278.4; // SCALE x (RESOLUTION - 1) = LENGTH & WIDTH ---> EG. 1.6 x (2050-1) = 3278.4
#declare WIDTH = 3278.4;
Image

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

Re: Tutorial - Rendering A Shadow Map

Postby jlv » Mon Mar 31, 2014 3:25 am

If your resolution is 2049 and scale is 1.6 it should be 1.6*(2049-1)=3276.8.

Is it way off or only off by a few feet?
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 » Mon Mar 31, 2014 4:04 pm

Its way off.

Heres the top several lines of stuff Im using, see any problems? Im using [4098, AA 0.3] too btw.

#include "colors.inc"
#include "rand.inc"

background {rgb <0.95,0.95,0.9>}

global_settings { ambient_light rgb <0.25, 0.25, 0.25> }

light_source {
< 1.0, 1.414, 1.0 > * 10000, color White * 1000 // PUT SUN CO-ORDINATE IN THE ARROW BRACKETS
parallel
point_at < 1.0 1.0 1.0>

}


#declare LENGTH =3276.8; // SCALE x (RESOLUTION - 1) = LENGTH & WIDTH ---> EG. 1.6 x (2050-1) = 3276.8
#declare WIDTH = 3276.8;

camera { orthographic location <WIDTH/2-1, 1000, LENGTH/2-1>
right <-WIDTH, 0, 0> up <0, 0, -LENGTH>
look_at <WIDTH/2-1, 0, LENGTH/2-1> }

#declare rangle = seed(0);



Then heres the screen shot of the shadows in place.

Image
Image

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

Re: Tutorial - Rendering A Shadow Map

Postby jlv » Tue Apr 01, 2014 12:57 am

Looks like it's way off. What's in your terrain.hf file? When you move the cursor to the bottom right of the terrain in the editor, what coordinates does it show?
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 Apr 01, 2014 1:23 am

2044.96-2044.96
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 » Tue Apr 01, 2014 1:30 am

Forgot, this is whats in the Terrain.hf file...

10 1.000000 11.276687 158.827667
Image

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

Re: Tutorial - Rendering A Shadow Map

Postby jlv » Tue Apr 01, 2014 3:18 am

Looks like your scale is set to 1, not 1.6. So your length and width should be 2048.
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 Apr 01, 2014 5:05 pm

Yes that worked! Huge thanks JLV, I could not figure out what was going on. To help me understand, what made it 1:1 scale? The amount of area I used of the map?
Image

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

Re: Tutorial - Rendering A Shadow Map

Postby jlv » Wed Apr 02, 2014 12:42 am

The scale is the second number in terrain.hf:
slowngreen wrote:Forgot, this is whats in the Terrain.hf file...

10 1.000000 11.276687 158.827667


It means each pixel in the terrain is 1 foot away from its neighbor.
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 Jun 01, 2014 2:37 am

Got a question again....Im putting shadows in a new track Im doing but every time it finishes the shadow render you can barely and I mean barely see any shadows on the white back ground and I think they are just the bales showing up. Im using the same trees as always, they just arent showing shadows.
Image


Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 1 guest