Tutorial - Rendering A Shadow Map

bdownen323
Posts: 2949
Joined: Mon Nov 28, 2011 11:00 pm

Re: Tutorial - Rendering A Shadow Map

Post by bdownen323 »

When I go to render out the shadows it saves the shadows file as shadows.png in my shadows folder. But when I open it up in ps and save it as a pgm image it says "error reading shadows" ingame. I have the shadows set to 2049x2049 just like the terrain. Any ideas?
bdownen323
Posts: 2949
Joined: Mon Nov 28, 2011 11:00 pm

Re: Tutorial - Rendering A Shadow Map

Post by bdownen323 »

DP, what should I do when it gives me this error?
Image
jlv
Site Admin
Posts: 14912
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Tutorial - Rendering A Shadow Map

Post by jlv »

When you save the pgm file, try converting to greyscale first. It might be saving a ppm file with a .pgm extension.

Not sure what the POV warning is about.
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.
bdownen323
Posts: 2949
Joined: Mon Nov 28, 2011 11:00 pm

Re: Tutorial - Rendering A Shadow Map

Post by bdownen323 »

I figured out the saving issue. I didn't realize I had to save it as a portable bitmap and make a pgm extension. I was trying to do a regular bitmap image with pgm extension. I'm still trying to figure out the pov issue.
wheels1758
Posts: 4132
Joined: Tue Oct 21, 2008 5:20 pm
Location: Washington, USA
Contact:

Re: Tutorial - Rendering A Shadow Map

Post by wheels1758 »

JLV,

Can you post your shadows.pov file (the one you use in conjunction with the shell script)?
jlv
Site Admin
Posts: 14912
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Tutorial - Rendering A Shadow Map

Post by jlv »

Here it is:

Code: Select all

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

background {rgb <0.95,0.95,0.9>}

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

#if (0)
light_source {
	< -0.5, 1.0, -1.0 > * 10000, color White * 1000
	parallel
	point_at <0, 0, 0>
}
#end

light_source { < LIGHTX, LIGHTY, LIGHTZ >, color White * 1000 }

#ifdef (DIM)
#declare WIDTH = DIM;
#declare LENGTH = DIM;
#else
#declare WIDTH = 1025;
#declare LENGTH = 1025;
#end
 
#ifndef (SCALE)
#declare SCALE = 0.625;
#end

camera { orthographic location <(WIDTH/2.0-0.5)*SCALE, 1000, (LENGTH/2-0.5)*SCALE>
         right <-WIDTH*SCALE, 0, 0> up <0, 0, -LENGTH*SCALE>
         look_at <(WIDTH/2.0-0.5)*SCALE, 0, (LENGTH/2-0.5)*SCALE> }

#declare rangle = seed(0);

#macro person()
cylinder {
	<0.0, 0.0, 0.0>, <0.0, 5.0, 0.0>, 0.75
}
#end

#macro hidden()
cylinder {
	<0.0, 0.0, 0.0>, <0.0, 5.0, 0.0>, 0.75
	no_shadow
}
#end

#macro _light()
	hidden()
#end

#macro _30sec_30()
	hidden()
#end

#macro _30sec_turn()
	hidden()
#end

#macro _30sec_5()
	hidden()
#end

#macro _30sec_run()
	hidden()
#end

#macro _30sec_done()
	hidden()
#end

#macro roost()
	hidden()
#end

#macro finish_green()
	person()
#end

#macro finish_crossed()
	person()
#end

#macro finish_white()
	person()
#end

#macro checkerwave()
	person()
#end

#macro flagger_resting()
	person()
#end

#macro flagger_waving()
	person()
#end

#macro guy01()
	person()
#end

#macro guy02()
	person()
#end

#macro guy03()
	person()
#end

#macro guy04()
	person()
#end

#macro guy05()
	person()
#end

#macro guy06()
	person()
#end

#macro girl01()
	person()
#end

#macro _triplight_green()
	hidden()
#end

#macro _phathry()
	person()
#end

#macro _sweendoggy()
	person()
#end


#include "trackstripped.pov"

object {
	statues
	texture {
		pigment { color rgb <0.0, 0.0, 1.0> }
		finish { diffuse 1.0 }
	}
	no_image
}
object {
	billboards
	texture {
		pigment { color rgb <0.0, 0.0, 1.0> }
		finish { diffuse 1.0 }
	}
	no_image
}
object {
	ground
	texture {
		pigment { color rgb <1.0, 1.0, 1.0> }
		finish { diffuse 1.0 }
	}
}
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.
wheels1758
Posts: 4132
Joined: Tue Oct 21, 2008 5:20 pm
Location: Washington, USA
Contact:

Re: Tutorial - Rendering A Shadow Map

Post by wheels1758 »

Thank you sir.
BETABERGGREN
Posts: 25
Joined: Fri Jan 10, 2014 7:04 pm
Team: Privateer

Re: Tutorial - Rendering A Shadow Map

Post by BETABERGGREN »

Can you make a movie on youtube on that?
Image
wheels1758
Posts: 4132
Joined: Tue Oct 21, 2008 5:20 pm
Location: Washington, USA
Contact:

Re: Tutorial - Rendering A Shadow Map

Post by wheels1758 »

BETABERGGREN wrote:Can you make a movie on youtube on that?
Who, on what?
MX181
Posts: 809
Joined: Tue Dec 25, 2012 12:45 am
Location: STRAYA

Re: Tutorial - Rendering A Shadow Map

Post by MX181 »

wheels1758 wrote:
BETABERGGREN wrote:Can you make a movie on youtube on that?
Who, on what?
im gueesing he wants to know how to use the script
wheels1758
Posts: 4132
Joined: Tue Oct 21, 2008 5:20 pm
Location: Washington, USA
Contact:

Re: Tutorial - Rendering A Shadow Map

Post by wheels1758 »

MX181 wrote:
wheels1758 wrote:
BETABERGGREN wrote:Can you make a movie on youtube on that?
Who, on what?
im gueesing he wants to know how to use the script
That's what I mean. If he is talking about the stuff in the first post by DJ, that's one thing.

If he doesn't know how to use the script(s) JLV posted, he's probably not running linux, so it is a bit of a moot point.
slowngreen
Posts: 907
Joined: Mon Sep 02, 2013 6:18 pm
Team: MotoPin Racing
Location: idaho

Re: Tutorial - Rendering A Shadow Map

Post by slowngreen »

Dont think its been asked....soooo...

Ive done everything and put the resized shadow.pgm into my track folder but no shadows show up and it says this across the top of the screen,
Texture rendering with framebuffer objects
Image
jlv
Site Admin
Posts: 14912
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Tutorial - Rendering A Shadow Map

Post by jlv »

You have to reshade the track in the editor. Put it in raise mode, submode lower only and then paint over the whole 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: 907
Joined: Mon Sep 02, 2013 6:18 pm
Team: MotoPin Racing
Location: idaho

Re: Tutorial - Rendering A Shadow Map

Post by slowngreen »

Oh ok thanks JLV!
Image
slowngreen
Posts: 907
Joined: Mon Sep 02, 2013 6:18 pm
Team: MotoPin Racing
Location: idaho

Re: Tutorial - Rendering A Shadow Map

Post by slowngreen »

Didnt work? Shouldnt the map change/lighten in color if its refreshed right? I tried JLV's way and also tried smoothing the entire map and nothing has changed (yes I save it and restart). Only difference is now it says at the top "rendering with textsubimage".
Image
Post Reply