POV-Ray : Newsgroups : povray.binaries.images : Animation with billboards Server Time
5 Nov 2024 07:17:33 EST (-0500)
  Animation with billboards (Message 1 to 10 of 13)  
Goto Latest 10 Messages Next 3 Messages >>>
From: Ray Gardener
Subject: Animation with billboards
Date: 5 Jun 2009 06:37:33
Message: <4a28f56d$1@news.povray.org>
Hi all, thought I'd share the output of Leveller's recent changes to its 
POV-Ray export -- textured billboards that auto-rotate to face the 
camera during stills and animations, plus path-based camera motion.

http://www.daylongraphics.com/products/landshaper_golf/gallery/povray_flyover3.swf

(The water waves are animated, but it's not really evident because of 
their far distance from the camera.)

Render speed was good; 2 hours for 240 frames of 512 x 384 on a single 
thread in 3.6. Hope to get quad-core 3.7 benchmarks later on.

max_trace has to be set very high, but the number of billboards 
intersecting an eye ray on average isn't great for a typical flyover.

Ray


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Animation with billboards
Date: 5 Jun 2009 10:36:39
Message: <4a292d77$1@news.povray.org>
Nice. I suppose only the trees are billboards?

Can this technique produce shadows as well?


Post a reply to this message

From: Cousin Ricky
Subject: Re: Animation with billboards
Date: 5 Jun 2009 15:45:00
Message: <web.4a297497a69c675a78641e0c0@news.povray.org>
Ray Gardener <ray### [at] daylongraphicscom> wrote:
> (The water waves are animated, but it's not really evident because of
> their far distance from the camera.)

Now that is one wicked water hazard!


Post a reply to this message

From: Ray Gardener
Subject: Re: Animation with billboards
Date: 5 Jun 2009 16:09:44
Message: <4a297b88$1@news.povray.org>
Christian Froeschlin wrote:
> Nice. I suppose only the trees are billboards?

Thank you; yes.


> Can this technique produce shadows as well?

Yes, but the shadows look increasingly wrong when the lightsource is at 
right angles to the viewing direction. The light "sees" the billboards 
from the side instead of face-on. Ground-level renders fare better 
because shadows get thin anyway, but overall I prefer to leave shadows off.

Shadows could probably be rendered in a separate pass by facing the 
billboards at the light and then compositing them back, but there's a 
point where the complexity of setting that up weighs against the 
simplicity of just using actual geometry (and it defeats the point of a 
raytracer to employ scanline-style workarounds). You could use cross 
billboards too.

The savings in memory and bounding-tree traversal are probably not high 
enough (or perhaps don't matter in these days of powerful hardware) to 
use billboards primarily, but I find them very helpful when prototyping 
because it's usually easier to get a picture than a model, and pictures 
are more portable between different renderers, gallery building is easy, 
etc. It's nice to have the option of dropping in billboards for any 
models that I don't have available yet -- I can quickly storyboard a 
scene, play with ideas, etc. before committing to making or finding the 
real geometry.

Joerg Schrammel's (Genesis Toolkit) work with textured cones is a neat 
in-between approach, which requires less (or no) camera-facing of trees 
and can cast reasonable shadows. The downside is that the textures are a 
little trickier to set up.

Mixing geometry with billboards is done to good effect for some trees. 
Trunk and branches are 3D but leaf clusters are billboards. They are 
rotated fully to camera-face (not just around the Y axis), and it's easy 
to sway them in animations to simulate wind. They also light better.


Some script code to experiment with:

// Some arrays go here, e.g., to define textures, texture lookup,
// billboard size/position, etc.

// The texture below is an example of one texture declaration.

#declare App_rect_texture[0] =
texture
{
	pigment
	{
		image_map
		{
			png "tree.png" map_type 0 interpolate 2 once
		}
		translate x * -0.5
	}
	finish { ambient 0.5 }
}


// App_cam_pos is normally assigned from an array of camera positions
// defined for an animation, e.g.,

#declare App_cam_pos = App_cam_positions[Current_frame_index];

#declare I = 0;

#while(I < App_number_of_objects)

	// I use a quad poly, but a two-tri mesh would work too.
	// I specified five instead of four points because otherwise
	// one gets a lot of "open poly; closing" warnings.
	polygon
	{
		5, <-0.5, 0>, <-0.5, 1>, <0.5, 1>, <0.5, 0>, <-0.5, 0>

		no_shadow // At your discretion. One could compute
		// a per-object lightsource angle and selectively
		// enable shadows for a threshold, or dupe the billboard
		// at right angles to itself (e.g., cross billboard).

		texture { App_texture[App_texture_index[I]] }
		// If you have several textures, put them in an
		// App_texture array, and then use an
		// App_texture_index array to translate object IDs
		// to textures.


		scale App_rect_size[I]
		// XY scale from unit square.
		// App_rect_size[I].z should always be 1.0

		#if(App_rect_billboard[I])
			// Cam-facing logic; rotates billboard only
			// around the Y axis.
			#declare App_v = App_cam_pos - App_rect_pos[I];
			#declare App_v = vnormalize(<App_v.x, 0, App_v.z>);
			#declare App_a = degrees(acos(vdot(App_v, <0,0,-1>)));
			#if(App_v.x > 0)
				#declare App_a = App_a * -1;
			#end
			rotate y * App_a
		#end
		translate App_rect_pos[I]
	}
	#declare I = I + 1;
#end


Ray


Post a reply to this message

From: Alain
Subject: Re: Animation with billboards
Date: 6 Jun 2009 11:14:41
Message: <4a2a87e1$1@news.povray.org>
Ray Gardener nous illumina en ce 2009-06-05 16:10 -->
> Christian Froeschlin wrote:
>> Nice. I suppose only the trees are billboards?
> 
> Thank you; yes.
> 
> 
>> Can this technique produce shadows as well?
> 
> Yes, but the shadows look increasingly wrong when the lightsource is at 
> right angles to the viewing direction. The light "sees" the billboards 
> from the side instead of face-on. Ground-level renders fare better 
> because shadows get thin anyway, but overall I prefer to leave shadows off.
> 
> Shadows could probably be rendered in a separate pass by facing the 
> billboards at the light and then compositing them back, but there's a 
> point where the complexity of setting that up weighs against the 
> simplicity of just using actual geometry (and it defeats the point of a 
> raytracer to employ scanline-style workarounds). You could use cross 
> billboards too.
> 
> The savings in memory and bounding-tree traversal are probably not high 
> enough (or perhaps don't matter in these days of powerful hardware) to 
> use billboards primarily, but I find them very helpful when prototyping 
> because it's usually easier to get a picture than a model, and pictures 
> are more portable between different renderers, gallery building is easy, 
> etc. It's nice to have the option of dropping in billboards for any 
> models that I don't have available yet -- I can quickly storyboard a 
> scene, play with ideas, etc. before committing to making or finding the 
> real geometry.
> 
> Joerg Schrammel's (Genesis Toolkit) work with textured cones is a neat 
> in-between approach, which requires less (or no) camera-facing of trees 
> and can cast reasonable shadows. The downside is that the textures are a 
> little trickier to set up.
> 
> Mixing geometry with billboards is done to good effect for some trees. 
> Trunk and branches are 3D but leaf clusters are billboards. They are 
> rotated fully to camera-face (not just around the Y axis), and it's easy 
> to sway them in animations to simulate wind. They also light better.
> 
>
You can have the shadows and the bilboards in one pass.
Just double the billboards. One set always faces the camera and is set to no_shadow.
The second set is set to face the light and is set to no_image.


Post a reply to this message

From: Ray Gardener
Subject: Re: Animation with billboards
Date: 6 Jun 2009 17:46:45
Message: <4a2ae3c5@news.povray.org>
Alain wrote:
> Ray Gardener nous illumina en ce 2009-06-05 16:10 -->
>> Christian Froeschlin wrote:
>>> Nice. I suppose only the trees are billboards?
>>
>> Thank you; yes.
>>
>>
>>> Can this technique produce shadows as well?
>>
>> Yes, but the shadows look increasingly wrong when the lightsource is 
>> at right angles to the viewing direction. The light "sees" the 
>> billboards from the side instead of face-on. Ground-level renders fare 
>> better because shadows get thin anyway, but overall I prefer to leave 
>> shadows off.
>>
>> Shadows could probably be rendered in a separate pass by facing the 
>> billboards at the light and then compositing them back, but there's a 
>> point where the complexity of setting that up weighs against the 
>> simplicity of just using actual geometry (and it defeats the point of 
>> a raytracer to employ scanline-style workarounds). You could use cross 
>> billboards too.
>>
>> The savings in memory and bounding-tree traversal are probably not 
>> high enough (or perhaps don't matter in these days of powerful 
>> hardware) to use billboards primarily, but I find them very helpful 
>> when prototyping because it's usually easier to get a picture than a 
>> model, and pictures are more portable between different renderers, 
>> gallery building is easy, etc. It's nice to have the option of 
>> dropping in billboards for any models that I don't have available yet 
>> -- I can quickly storyboard a scene, play with ideas, etc. before 
>> committing to making or finding the real geometry.
>>
>> Joerg Schrammel's (Genesis Toolkit) work with textured cones is a neat 
>> in-between approach, which requires less (or no) camera-facing of 
>> trees and can cast reasonable shadows. The downside is that the 
>> textures are a little trickier to set up.
>>
>> Mixing geometry with billboards is done to good effect for some trees. 
>> Trunk and branches are 3D but leaf clusters are billboards. They are 
>> rotated fully to camera-face (not just around the Y axis), and it's 
>> easy to sway them in animations to simulate wind. They also light better.
>>
>>
> You can have the shadows and the bilboards in one pass.
> Just double the billboards. One set always faces the camera and is set 
> to no_shadow.
> The second set is set to face the light and is set to no_image.

Hey, yeah, thanks, I'll try that.
Ray


Post a reply to this message

From: Ray Gardener
Subject: Re: Animation with billboards
Date: 6 Jun 2009 20:26:16
Message: <4a2b0928@news.povray.org>
Cousin Ricky wrote:
> Now that is one wicked water hazard!

Yep. The heightfield is actually based on part of a real course, 
although I forget where exactly (the layout anyway; I had to guess at 
the elevations). Some people like their holes challenging. :)

There aren't any water hazards actually in the line of play; it's just 
on the surrounding perimeter. If you shank, on another course you'd be 
deep in some bad rough anyway (or on another fairway).

Shadows coming out nice per Alain's suggestion (attached image), the 
video is about halfway rendered. I added 'no_reflection' to the 
light-facing billboards as well to keep reflections matched to the 
cam-facing boards.

Ray


Post a reply to this message


Attachments:
Download 'animtest102.png' (392 KB)

Preview of image 'animtest102.png'
animtest102.png


 

From: Ray Gardener
Subject: Re: Animation with billboards
Date: 6 Jun 2009 21:56:42
Message: <4a2b1e5a@news.povray.org>
Same animation, with shadows:

http://www.daylongraphics.com/products/landshaper_golf/gallery/povray_flyover4.swf 


Ray


Post a reply to this message

From: Alain
Subject: Re: Animation with billboards
Date: 7 Jun 2009 10:54:01
Message: <4a2bd489$1@news.povray.org>
Ray Gardener nous illumina en ce 2009-06-06 20:27 -->
> Cousin Ricky wrote:
>> Now that is one wicked water hazard!
> 
> Yep. The heightfield is actually based on part of a real course, 
> although I forget where exactly (the layout anyway; I had to guess at 
> the elevations). Some people like their holes challenging. :)
> 
> There aren't any water hazards actually in the line of play; it's just 
> on the surrounding perimeter. If you shank, on another course you'd be 
> deep in some bad rough anyway (or on another fairway).
> 
> Shadows coming out nice per Alain's suggestion (attached image), the 
> video is about halfway rendered. I added 'no_reflection' to the 
> light-facing billboards as well to keep reflections matched to the 
> cam-facing boards.
> 
> Ray
> 
> 
> 
> ------------------------------------------------------------------------
> 
Now, the only thing that can tip you is that the bilboards don't self shadow. 
Most peoples won't notice that, it's minimised by the actual texture and the 
shadows from the other ones.


Post a reply to this message

From: Darren New
Subject: Re: Animation with billboards
Date: 7 Jun 2009 12:46:19
Message: <4a2beedb$1@news.povray.org>
Ray Gardener wrote:
> Same animation, with shadows:

Very nice. You have to look very close to tell the trees are billboards.

-- 
   Darren New, San Diego CA, USA (PST)
   There's no CD like OCD, there's no CD I knoooow!


Post a reply to this message

Goto Latest 10 Messages Next 3 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.