POV-Ray : Newsgroups : povray.newusers : Trace question Server Time
30 Dec 2024 15:19:25 EST (-0500)
  Trace question (Message 1 to 7 of 7)  
From: Mick Hazelgrove
Subject: Trace question
Date: 7 Jul 2001 07:59:41
Message: <3b46f9ad@news.povray.org>
I have a hf created with an isosurface. I want to place grass on it  - easy
BUT I only want to place grass on the sides of the hills facing the camera.
How can I test to see which slopes are facing me and which are hidden.

Mick


Post a reply to this message

From: Simon
Subject: Re: Trace question
Date: 7 Jul 2001 08:29:03
Message: <3b47008f@news.povray.org>
Mick Hazelgrove <mic### [at] mhazelgrovefsnetcouk> schrieb in im Newsbeitrag:
3b46f9ad@news.povray.org...
> I have a hf created with an isosurface. I want to place grass on it  -
easy
> BUT I only want to place grass on the sides of the hills facing the
camera.
> How can I test to see which slopes are facing me and which are hidden.
>
> Mick

You could use an orthographic camera,
and look down on the hf.
Give the hf a white texture with ambient 0 and place one
light there where your camera should be in the final image.
You could use the resulting image to place the grass.
I don't know if this woks but I think it should.


Post a reply to this message

From: Christoph Hormann
Subject: Re: Trace question
Date: 7 Jul 2001 08:31:21
Message: <3B47017C.3245D9A4@gmx.de>
Mick Hazelgrove wrote:
> 
> I have a hf created with an isosurface. I want to place grass on it  - easy
> BUT I only want to place grass on the sides of the hills facing the camera.
> How can I test to see which slopes are facing me and which are hidden.
> 

Just do a second trace against the camera location and leave out all
positions where this trace is successful.  Of course this could be
problematic, since you probably want also some grass just below the
visibility line.

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Margus Ramst
Subject: Re: Trace question
Date: 7 Jul 2001 10:14:59
Message: <3b471963@news.povray.org>
"Mick Hazelgrove" <mic### [at] mhazelgrovefsnetcouk> wrote:

> I have a hf created with an isosurface. I want to place grass on it  -
> easy BUT I only want to place grass on the sides of the hills facing the
> camera. How can I test to see which slopes are facing me and which are
> hidden.
> 

Trace the point, and compare the surface normal at the point to the
camera->point vector. If the angle between the two is greater than 90
degrees, the surface is facing away from the camera. You might also want to
include points just below the horizon, i.e. points where the angle is a bit
more than 90 degrees. Example:

//CamPos: camera location
//TestPos: traced point on the HF
//N: surface normal at the point
//MaxAngle: 90 is at the horizon, >90 is beyond the horizon

#declare CamDir=vnormalize(TestPos-CamPos);
#if(vdot(CamDir,N)>cos(radians(MaxAngle)))
    //put grass here
#end

-- 
Margus Ramst

Personal e-mail: mar### [at] peakeduee
TAG (Team Assistance Group) e-mail: mar### [at] tagpovrayorg
Home page http://www.hot.ee/margusrt


Post a reply to this message

From: Mick Hazelgrove
Subject: Re: Trace question
Date: 7 Jul 2001 14:18:36
Message: <3b47527c@news.povray.org>
Thanks

This seems to be what I want, I've been close but didn't take into account
the camera position!

Thanks again

Mick


Post a reply to this message

From: Mick Hazelgrove
Subject: Re: Trace question
Date: 7 Jul 2001 15:20:09
Message: <3b4760e9$1@news.povray.org>
> #declare CamDir=vnormalize(TestPos-CamPos);
> #if(vdot(CamDir,N)>cos(radians(MaxAngle)))
>     //put grass here
> #end

BTW shouldn't that be

#if(vdot(CamDir,N)<cos(radians(MaxAngle))) ?

Mick


Post a reply to this message

From: Margus Ramst
Subject: Re: Trace question
Date: 7 Jul 2001 16:36:59
Message: <3B4748AD.F30D323E@peak.edu.ee>
Mick Hazelgrove wrote:
> 
> BTW shouldn't that be
> 
> #if(vdot(CamDir,N)<cos(radians(MaxAngle))) ?

Right, sorry. Bear in mind though that with this <90 degrees faces away
from you. To make it work the way I described (personally, I find that
more intuitive), the correct version is:

#if(vdot(CamDir,-N)>cos(radians(MaxAngle)))

-- 
Margus Ramst

Personal e-mail: mar### [at] peakeduee
TAG (Team Assistance Group) e-mail: mar### [at] tagpovrayorg
Home page http://www.hot.ee/margusrt


Post a reply to this message

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