POV-Ray : Newsgroups : povray.general : Tips for Short Code Contest : Re: Tips for Short Code Contest Server Time
31 Jul 2024 18:25:15 EDT (-0400)
  Re: Tips for Short Code Contest  
From: Mike Kost
Date: 13 Oct 2006 19:14:52
Message: <45301dec@news.povray.org>
Warp wrote:
> Mike Kost <con### [at] povraytashcorpnet> wrote:
>> 1. What Camera?
> 
>> It helps to remove the camera declaration out of the scene. The default
>> camera is located at <0,0,0> and looking at <0,0,1>. If you must move the
>> camera, the camera will continue to look in the +z direction from it's
>> new location, the equivalent of 'camera{location loc look_at loc+z}'.
>> This prevents having to use 'look_at <a,b,c>'
> 
>   Usually putting a camera statement at all is a waste of space.
>   Translating
> the scene usually takes less space. And yes, you can often use tricks to
> avoid the 'translate' keyword too.
> 
>> What's even better is that you can throw out the rgb reference if you use
>> vectors, i.e.:
>>  'pigment{color x}' = 'pigment{color rgb <1,0,0>}'
> 
>   Why not 'pigment{rgb x}'?
> 
>   This is not just a "short code trick", it should be basic knowledge
>   right
> from the documentation.

Good suggestion for 'rgb x' instead of 'color x'.

Whether this is basic knowledge or not, I'm interested in encouraging 
entries in the short code contest. If someone hasn't read the documents
closely for syntax structure, it's helpful to know it. 

>> 3. Vector Substitution
> 
>> A constant 'C' will be interpreted as '<C,C,C>' if the parser needs a
>> vector. This can be quite useful since '1-z' is equivalent to '<1,1,0>',
>> but with less than half the bytes.
> 
>   Again not even a "trick", but basic info straight from the
>   documentation.
> 
>> #macro a(b)#if(b<5)box{-1,1scale.5translate y-3pigment{color x}}#end#end
> 
>   That's not even the shortest way of doing that ;)

No, but it got the point across. 

Mike
--
http://povray.tashcorp.net


Post a reply to this message

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