Tutorial - Rendering A Shadow Map

Post Reply
Motoboss
Posts: 1329
Joined: Wed Apr 02, 2008 10:17 pm
Location: St Louis MO
Contact:

Re: Tutorial - Rendering A Shadow Map

Post by Motoboss »

Blur in PS is your friend.... :wink:
Appreciate my hard work? Buy me a beer,
https://www.paypal.me/Motoboss
Check out my Facebook Page
My YouTube Channel - https://www.youtube.com/channel/UCR5gAn ... z59ykqiKyA
RFX_corentin_12
Posts: 1200
Joined: Tue Oct 11, 2011 1:26 pm
Team: Impact
Location: France

Re: Tutorial - Rendering A Shadow Map

Post by RFX_corentin_12 »

Hi, I'm doing well as it should, but when I get to step 6, I click on the run button but its brand me this:

Image

I do how?

thank you;)
Image
yz171kx12
Posts: 631
Joined: Thu Feb 17, 2011 11:21 pm
Location: Southern California

Re: Tutorial - Rendering A Shadow Map

Post by yz171kx12 »

RFX_corentin_12 wrote:Hi, I'm doing well as it should, but when I get to step 6, I click on the run button but its brand me this:

Image

I do how?

thank you;)
I normally just delete the startgate shadows. You can just delete the super thin objects from track.pov if it says they're missing a texture because it probably won't render shadows for them anyways.
barrington314
Posts: 6614
Joined: Fri Feb 18, 2011 6:03 pm
Team: me
Location: Charleston, SC

Re: Tutorial - Rendering A Shadow Map

Post by barrington314 »

I noticed that some people turn the pgm into a png and place it in as one big decal. Is there a benefit to that, maybe with load times or frame rate? Im sure it wouldnt be much but some tracks are coming to the point that any extra resource help is nice to use.
MotoX745
Posts: 930
Joined: Wed Aug 17, 2011 7:12 pm
Location: North Carolina

Re: Tutorial - Rendering A Shadow Map

Post by MotoX745 »

idk might make it easier to line up shadows i'm having trouble with the PGM's on lining up shadows
Image
Attempted Photographer < I try.... Shitty racer, Only good at screenshots, forever pretending to be quick at MXS.
jlv
Site Admin
Posts: 14928
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Tutorial - Rendering A Shadow Map

Post by jlv »

It won't be lit correctly that way. It'll just be darker instead of being lit by ambient only. It won't be any faster.
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.
barrington314
Posts: 6614
Joined: Fri Feb 18, 2011 6:03 pm
Team: me
Location: Charleston, SC

Re: Tutorial - Rendering A Shadow Map

Post by barrington314 »

Is there a trick to doing shadows for supercross, since it needs to be cast from multiple angles? Render it 6 - 8 separate times?
jlv
Site Admin
Posts: 14928
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Tutorial - Rendering A Shadow Map

Post by jlv »

Yes, it's six renders blended together. I use this shell script to automate it.

Code: Select all

#!/bin/bash

sed 's/image_map[^}]*}/Black/g' <track.pov >trackstripped.pov

scale=$(awk '{print $2}' <terrain.hf)

n=0
grep flare_point <lighting | sed 's/[][]//g' |
while read flare_point x y z rest
do
        nice -19 /opt/povray/bin/povray -D -w2050 -h2050 \
         Declare=SCALE=$scale \
         Declare=LIGHTX=$x \
         Declare=LIGHTY=$y \
         Declare=LIGHTZ=$z shadows.pov || break
        mv shadows.png shadow$n.png
        n=$((n+1)) # this is in a subshell and doesn't update the outer scope
done

n=$(ls shadow[0-9].png | wc -l)

scale=$(bc <<<"scale=5;1/$n")
pngtopnm <shadow0.png | pamfunc -multiplier $scale >s.ppm
for ((i=1;i<n;i++))
do
        echo combine $i
        pngtopnm <shadow$i.png | pamfunc -multiplier $scale >t.ppm
        pamarith -add s.ppm t.ppm >u.ppm
        mv u.ppm s.ppm
done

ppmtopgm s.ppm | pamscale -xysize 1025 1025 >shadows.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.
twistmoto
Posts: 195
Joined: Tue Jul 24, 2012 11:27 pm
Team: TwistMoto Racing
Location: Arizona
Contact:

Re: Tutorial - Rendering A Shadow Map

Post by twistmoto »

jlv wrote:Yes, it's six renders blended together. I use this shell script to automate it.

Code: Select all

#!/bin/bash

sed 's/image_map[^}]*}/Black/g' <track.pov >trackstripped.pov

scale=$(awk '{print $2}' <terrain.hf)

n=0
grep flare_point <lighting | sed 's/[][]//g' |
while read flare_point x y z rest
do
        nice -19 /opt/povray/bin/povray -D -w2050 -h2050 \
         Declare=SCALE=$scale \
         Declare=LIGHTX=$x \
         Declare=LIGHTY=$y \
         Declare=LIGHTZ=$z shadows.pov || break
        mv shadows.png shadow$n.png
        n=$((n+1)) # this is in a subshell and doesn't update the outer scope
done

n=$(ls shadow[0-9].png | wc -l)

scale=$(bc <<<"scale=5;1/$n")
pngtopnm <shadow0.png | pamfunc -multiplier $scale >s.ppm
for ((i=1;i<n;i++))
do
        echo combine $i
        pngtopnm <shadow$i.png | pamfunc -multiplier $scale >t.ppm
        pamarith -add s.ppm t.ppm >u.ppm
        mv u.ppm s.ppm
done

ppmtopgm s.ppm | pamscale -xysize 1025 1025 >shadows.pgm
I was working on a SX night track recently (I had ten lights... ;) ) and could not for the life of me remember how to correctly code a batch file to accomplish this, and an hour in Linux reminded me of everything I have forgot about it so I made some adjustments to the shadows.pov.
I set it up to use spotlights and render all of the lights at once. Maybe this will help somebody out when they are trying to setup their shadow map. If you get stuck there are instructions in the file, and you will need to follow DJs basic instructions.
http://www.mediafire.com/download/gvrpb ... shadows.7z
Image
Maczust63
Posts: 619
Joined: Sun Jan 08, 2012 10:12 am
Team: Chicken Wings & Beer
Location: ON, Canada
Contact:

Re: Tutorial - Rendering A Shadow Map

Post by Maczust63 »

I got this error and dont know where to begin im not good with this so be kinda and any help would be great
Image
twistmoto
Posts: 195
Joined: Tue Jul 24, 2012 11:27 pm
Team: TwistMoto Racing
Location: Arizona
Contact:

Re: Tutorial - Rendering A Shadow Map

Post by twistmoto »

You have to remove the startgate.ppm lines from your track pov file, before you run the shadows.pov. Also make sure there are no billboard lines in your tracks pov cause that will be the next error.
Image
barrington314
Posts: 6614
Joined: Fri Feb 18, 2011 6:03 pm
Team: me
Location: Charleston, SC

Re: Tutorial - Rendering A Shadow Map

Post by barrington314 »

twistmoto wrote:You have to remove the startgate.ppm lines from your track pov file, before you run the shadows.pov. Also make sure there are no billboard lines in your tracks pov cause that will be the next error.
Or just make a ppm image in photoshop thats a solid color and save it as startgate.ppm and put that in the render folder.
Maczust63
Posts: 619
Joined: Sun Jan 08, 2012 10:12 am
Team: Chicken Wings & Beer
Location: ON, Canada
Contact:

Re: Tutorial - Rendering A Shadow Map

Post by Maczust63 »

okay ill try that thanks
jlv
Site Admin
Posts: 14928
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Tutorial - Rendering A Shadow Map

Post by jlv »

sed 's/image_map[^}]*}/Black/g' <track.pov >trackstripped.pov

Unix makes life easier!

If you're on Windows you want to replace all image_map sections with "Black". So if you have this:

texture { uv_mapping pigment { image_map { png "sx2013/scorehousemotooption.png"} } scale <1,-1,1> }

You want to edit it to this:

texture { uv_mapping pigment { Black } scale <1,-1,1> }
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.
Maczust63
Posts: 619
Joined: Sun Jan 08, 2012 10:12 am
Team: Chicken Wings & Beer
Location: ON, Canada
Contact:

Re: Tutorial - Rendering A Shadow Map

Post by Maczust63 »

thanks ill try this stuff when im less frustrated with new programs haha
Post Reply