POV-Ray : Newsgroups : povray.general : change finish of pre-defined objects Server Time
17 Nov 2024 01:14:59 EST (-0500)
  change finish of pre-defined objects (Message 1 to 4 of 4)  
From: The Brain
Subject: change finish of pre-defined objects
Date: 17 Jul 2003 07:05:02
Message: <3f1682de@news.povray.org>
Hi.

I defined some objects with #define MyObject = etc. These objects have a
finish block including specular and roughness.

when I try to use these definition with the object-command, I also add an
finish-block, including ambient
object {MyObject finish {ambient 1}}
The object is a semi-transparent lamp, and I want to make it glow. But
nothing happens. I am sad :).


Post a reply to this message

From: The Brain
Subject: Oops
Date: 17 Jul 2003 07:06:54
Message: <3f16834e@news.povray.org>
I mean #declare, not #define ^^


Post a reply to this message

From: Chris Amshey
Subject: Re: change finish of pre-defined objects
Date: 18 Jul 2003 18:15:01
Message: <web.3f18711d97c1a61161b99e900@news.povray.org>
The Brain wrote:
>Hi.
>
>I defined some objects with #define MyObject = etc. These objects have a
>finish block including specular and roughness.
>
>when I try to use these definition with the object-command, I also add an
>finish-block, including ambient
>object {MyObject finish {ambient 1}}
>The object is a semi-transparent lamp, and I want to make it glow. But
>nothing happens. I am sad :).
>
This is a problem - or feature - of CSG objects. The behaviour is not,
AFAIK, documented, but it looks like this:

---
// Example: 'Hey, this paint doesn't stick!'
#declare RedCar = union { object { Windshield texture { WindowGlass } }
        object { CarBody texture { RedPaint } }
}
#declare BlueCar = object { RedCar texture { BluePaint } }
object { BlueCar } // Sorry, car is still red!
---
// Example: Paintable Car
#declare UnfinishedCar = union { object { Windshield texture { WindowGlass }
}
object { CarBody } // no texture yet!
}

#declare RedCar = object { UnfinishedCar texture { RedPaint } }
#declare BlueCar = object { UnfinishedCar texture { BluePaint } }
object { RedCar translate x * -CarWidth } // ooh, red!
object { RedCar translate x * CarWidth } // ooh, blue!
---
// Example: Paintable Car with Default Color
#declare BasicCar = object {
union {
 object { Windshield texture { WindowGlass } }
 object { CarBody } // No texture yet!
}
 texture { RedPaint } // default paint job
}
#declare RedCar = { BasicCar } // that's a red car all right...
#declare BlueCar = { BasicCar texture { BluePaint } } // that's a blue
car...
#declare BadGlowCar = { BasicCar texture { finish { ambient 1 } } /* that's
a
 -black- car... by using a 'texture' block we overwrite -all- texture
elements - but -only- for the carbody. WindowGlass is still 'permanent' by
being in the CSG. */
#declare GoodGlowCar = { BasicCar finish { ambient 1 } } // that's a glowing
red car...
---

That should get the idea across, I hope. Another solution is,
---
#macro MkCar(WindowTexture,BodyTexture)
union {
 object { Windshield texture { WindowTexture } }
 object { CarBody texture { BodyTexture } }
}
#end
#declare RedCar = MkCar(WindowGlass,RedPaint)
#declare BlueCar = MkCar(WindowGlass,BluePaint)
#declare GlowCar = MkCar(GlowGlass,GlowPaint)
// etc...

---

And no, I have no idea if CSG textures work this way on purpose or by
accident, but the net result is, you have to plan ahead - or go back and
recode - when you want to change the texture on a CSG object. On the other
hand, there are advantages to be had (like the way the windows in the
second example won't get colored when you 'repaint' the car...)

The POV-Team - or anyone else - has permission to incorporate this post into
any Povray FAQ or Povray documentation, though someone might check it
for accuracy... ;)

--Chris


Post a reply to this message

From: The Brain
Subject: Thx
Date: 23 Jul 2003 13:33:24
Message: <3f1ec6e4@news.povray.org>
m'kay, that helped. Thanx :)


Post a reply to this message

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