POV-Ray : Newsgroups : povray.general : Snail shells Server Time
28 Apr 2024 00:15:35 EDT (-0400)
  Snail shells (Message 1 to 6 of 6)  
From: Thomas Fester
Subject: Snail shells
Date: 2 Dec 2023 16:45:00
Message: <web.656ba4e8dd0b55cfa206535f8a2a825f@news.povray.org>
Hello everybody,

recently I posted a video about snail shells, where I talk about producing
images like the one attached. I thought about including my code in the youtube
comments section, but there are technical problems. So I am including this code
right here. Please tell me, in case there are better forms of distributing such
scripts. Also suggestions for improving the readability of my code are
welcome...

Best regards,

Thomas

// Persistence of Vision Ray Tracer Scene Description File
// File: ?.pov

#version 3.6;


global_settings {
  assumed_gamma 1.0
  max_trace_level 25
 //radiosity {}
}




#declare Cameraz = camera {
  location  <1, 0, -10>
look_at   <0, 0,  0>
}



camera {Cameraz}



sky_sphere {
  pigment {
    gradient y
    color_map { [0.0 color rgb <1,1,1>] [0.5 color rgb <1,1,1>] [1.0 color rgb
<1,1,1>] }
  scale 2
  translate -1
  }
}



// create a regular point light source
light_source {
  0*x                  // light's position (translated below)
  color rgb <1,1,1>    // light's color
  translate <1, 1, -200>
}


light_source {
  0*x                  // light's position (translated below)
  color rgb <1,1,1>    // light's color
  translate <-100, 100, 00>
 }


//Light in the opening of the snail shell

light_source {
  0*x                  // light's position (translated below)
  color rgb <1,1,1>    // light's color
  translate <2, -2.5, 0>
 }


//---------------------------Objects-----------------------------------------------------------------

//Spiral parameters
#declare Inclination = 0.01045;
#declare HeightVariable = 0.105;
#declare RadiusVariable = 0.0355;
#declare ThicknessVariable = 0.04;


//Starting position on y-axix
#declare YStart = 3.9;




blob {
  threshold 0.6

#declare ticker = 0;
#while (ticker<400)


#declare Angle = 5.5 * ticker;

#declare Radius = RadiusVariable * exp(Inclination*ticker);
#declare DeltaY = HeightVariable * exp(Inclination*ticker);
#declare Gauge = ThicknessVariable * exp(Inclination*ticker);


sphere { <0, 0, 0>, 1.2*Gauge , 0.3       //This sphere produces the solid shell
translate <Radius, YStart - DeltaY, 0>
rotate <0, Angle, 0>
  pigment {
 color rgb<255/255, 160/255, 50/255>
  }
}


sphere { <0, 0, 0>, 0.9*Gauge , -1             //And this sphere is substracted
and produces the inner void
translate <0.9*Radius, YStart - DeltaY, 0>
rotate <0, Angle, 0>
  pigment {
    color rgb<255/255, 255/255, 255/255>   // solid color pigment
  }
}


// Decorations - "spikes"

#if (mod(ticker, 10) = 0)    //a spike is inserted every thenth element

sphere { <0, 0, 0>, Gauge/3 , 0.5
scale <4, 1, 1>
translate <Gauge, 0, 0>
rotate <0, 0, 50>                          //This rotation produces the upper
row of spikes
translate <Radius, YStart - DeltaY, 0>
rotate <0, Angle, 0>
  pigment {
    color rgb<20/255, 0/255, 0/255>   // solid color pigment
  }
}


sphere { <0, 0, 0>, Gauge/3 , 0.5
scale <4, 1, 1>
translate <Gauge, 0, 0>
rotate <0, 0, -15>                       //and this rotation produces the lower
row of spikes
translate <Radius, YStart - DeltaY, 0>
rotate <0, Angle, 0>
  pigment {
    color rgb<20/255, 0/255, 0/255>   // solid color pigment
  }
}


#else
#end


#declare ticker = ticker + 1;
#end

}




//Stripes


blob {
  threshold 0.6

#declare ticker = 0;
#while (ticker<396)


#declare Angle = 5.5 * ticker;

#declare Radius = RadiusVariable * exp(Inclination*ticker);
#declare DeltaY = HeightVariable * exp(Inclination*ticker);
#declare Gauge = ThicknessVariable * exp(Inclination*ticker);


#declare ticker2 = 0;
#while (ticker2< 10)


sphere { <0, 0, 0>, 0.1*Gauge , 1
scale <1, 0.5 4>
translate <0.8*Gauge, 0, 0>
rotate <0, 0, -25+ticker2*10>          //This rotation produces the various
stripes
translate <Radius, YStart - DeltaY, 0>
rotate <0, Angle, 0>
  pigment {
 color rgb<20/255, 0/255, 0/255>
  }
}


#declare ticker2 = ticker2 + 1;
#end


#declare ticker = ticker + 1;
#end

}


Post a reply to this message


Attachments:
Download '18decog.png' (296 KB)

Preview of image '18decog.png'
18decog.png


 

From: Bald Eagle
Subject: Re: Snail shells
Date: 2 Dec 2023 19:20:00
Message: <web.656bc8cfbeba1b401f9dae3025979125@news.povray.org>
"Thomas Fester" <tfe### [at] scivitde> wrote:
> Hello everybody,
>
> recently I posted a video about snail shells, where I talk about producing
> images like the one attached. I thought about including my code in the youtube
> comments section, but there are technical problems. So I am including this code
> right here. Please tell me, in case there are better forms of distributing such
> scripts. Also suggestions for improving the readability of my code are
> welcome...

You _might_ consider posting on github, as this is apparently what many people
do with their code repositories.

Also, it would be better to post the .pov file as an attachment.
If you use the web reader, then it's only 1 attachment per post, and you'll have
to post 2 messages - 1 for the .pov file, and 1 for the rendered image.  If you
use a news reader like Thunderbird, then you can attach multiple files to a
single message.

I like your coding style.  Very close to my own, with spacing, etc.

I reformatted your file to use tabbed indentations (Hi, jr!) and added a few
comments.

Since your purpose will be to write these scenes for educational purposes, let
me suggest a few things to consider:

1.  References.
I almost went off on a huge shell tangent myself, so I know that there are
several excellent websites and textbooks which cover this topic.  It might be
good for to include a few references to acknowledge prior work, as well as give
them some resources to investigate and inspire.

2. Magic numbers.
Your spiral parameters are just hard coded numbers, but if they are derived from
anything, or have some relationship between one another, then it's usually good
coding practice to try to explain why the values are what they are, or express
values that are based on prior values as functions of the base value.

3. Code hierarchy
Since you're probably coding for people new to either coding or SDL in
particular, it's always a good idea to keep the instantiation of primitives and
code-control directives clear and easy to follow.  Everything in SDL terminates
either with an } or and #end - so there's no way to know what you're ending
without scrolling back up through the scene - which if the indentation isn't
clearly demarcated, can be hell to follow (and debug).

4. Colors
It looks like your color values are derived from an external color picker, so
you're dividing by 255.  First, you may want to use the srgb keyword, and
second, there's a lot more to this simple color conversion than there might
appear at first glance.  I'll let you search the forums for the fun
conversations we've had about colors and gamma correction, and srgb.

5. union {}
Your shell and your stripes are 2 different objects, which means they will not
be transformed together.   Just put them in a union.

6. Versatility
For many of the morphologies that you're modeling, there are parameters than be
altered to produce different results.
You might consider making a macro so that the parameters can be changed easily.
Then you might make your renders with a variety of parameters to show how easily
one can produce a wide variety of results with essentially the same code.

7. Diagrams
For things like the shells, you might consider adding a small diagram showing
angles and translations-per-turn, etc.
The more you add visual pieces that can be used as instructional tools, the more
your work might be consulted and referenced in other work ---- which gets people
to consult your work even further.
The blobs are _excellent_.  What you're doing with blobs/metaballs is really
great, and more than what I'm usually capable of pulling off.
That said, you might show where that approach can go wrong - or at least be
picky in terms of distance and field strength.
You might also consider using spheres or a mesh or a wireframe to show the basic
structure - and then show how the blobs melt everything together.

8. A "Final" render, or a growing add-on scene.
You have all of these various plants and creatures, but how about placing them
into a nice scene to show them in context?
It would be easy enough to make a simple beach scene and start adding modeled
creature after modeled creature.  So every video gets an addition to a base
scene.  Model 1 shell, then scatter 500 into the sand.  Model 1 beach grass
plant, then plant a few hundred on a dune.  Add some radiosity and an HDR light
probe, and the results can be dramatic.
Sometime people will put a line of commented code at the top of their scene, to
provide recommended command-line options for getting the best results for
certain scenes.

Gotta have some clever and entertaining ways to slip in those "like" and
"subscribe" requests.  Written in the sand.  The pattern of shells on the beach.
 An aerial banner or skywriting over the ocean.  A message in a bottle.   Go
nuts.  ;)

And as always, you can always solicit advice, code, textures, or scene files to
use in your work.  Maybe throw some POV-Ray logos in there as well to show off
your favorite script-driven raytracer.

- Bill


Post a reply to this message


Attachments:
Download 'snailshells.pov.txt' (4 KB)

From: jr
Subject: Re: Snail shells
Date: 3 Dec 2023 06:30:00
Message: <web.656c65a3beba1b407f6d9cf76cde94f1@news.povray.org>
hi,
"Bald Eagle" <cre### [at] netscapenet> wrote:
> ...
> I reformatted your file to use tabbed indentations (Hi, jr!) and ...

"Infamy infamy, they've all got it in for me"
(as the late Frankie Howerd would have said..  :-))


regards, jr.


Post a reply to this message

From: Thomas Fester
Subject: Re: Snail shells
Date: 5 Dec 2023 11:35:00
Message: <web.656f500bbeba1b40a206535f8a2a825f@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "Thomas Fester" <tfe### [at] scivitde> wrote:
> > Hello everybody,
> >
> > recently I posted a video about snail shells, where I talk about producing
> > images like the one attached. I thought about including my code in the youtube
> > comments section, but there are technical problems. So I am including this code
> > right here. Please tell me, in case there are better forms of distributing such
> > scripts. Also suggestions for improving the readability of my code are
> > welcome...
>
> You _might_ consider posting on github, as this is apparently what many people
> do with their code repositories.
>
> Also, it would be better to post the .pov file as an attachment.
> If you use the web reader, then it's only 1 attachment per post, and you'll have
> to post 2 messages - 1 for the .pov file, and 1 for the rendered image.  If you
> use a news reader like Thunderbird, then you can attach multiple files to a
> single message.
>
> I like your coding style.  Very close to my own, with spacing, etc.
>
> I reformatted your file to use tabbed indentations (Hi, jr!) and added a few
> comments.
>
> Since your purpose will be to write these scenes for educational purposes, let
> me suggest a few things to consider:
>
> 1.  References.
> I almost went off on a huge shell tangent myself, so I know that there are
> several excellent websites and textbooks which cover this topic.  It might be
> good for to include a few references to acknowledge prior work, as well as give
> them some resources to investigate and inspire.
>
> 2. Magic numbers.
> Your spiral parameters are just hard coded numbers, but if they are derived from
> anything, or have some relationship between one another, then it's usually good
> coding practice to try to explain why the values are what they are, or express
> values that are based on prior values as functions of the base value.
>
> 3. Code hierarchy
> Since you're probably coding for people new to either coding or SDL in
> particular, it's always a good idea to keep the instantiation of primitives and
> code-control directives clear and easy to follow.  Everything in SDL terminates
> either with an } or and #end - so there's no way to know what you're ending
> without scrolling back up through the scene - which if the indentation isn't
> clearly demarcated, can be hell to follow (and debug).
>
> 4. Colors
> It looks like your color values are derived from an external color picker, so
> you're dividing by 255.  First, you may want to use the srgb keyword, and
> second, there's a lot more to this simple color conversion than there might
> appear at first glance.  I'll let you search the forums for the fun
> conversations we've had about colors and gamma correction, and srgb.
>
> 5. union {}
> Your shell and your stripes are 2 different objects, which means they will not
> be transformed together.   Just put them in a union.
>
> 6. Versatility
> For many of the morphologies that you're modeling, there are parameters than be
> altered to produce different results.
> You might consider making a macro so that the parameters can be changed easily.
> Then you might make your renders with a variety of parameters to show how easily
> one can produce a wide variety of results with essentially the same code.
>
> 7. Diagrams
> For things like the shells, you might consider adding a small diagram showing
> angles and translations-per-turn, etc.
> The more you add visual pieces that can be used as instructional tools, the more
> your work might be consulted and referenced in other work ---- which gets people
> to consult your work even further.
> The blobs are _excellent_.  What you're doing with blobs/metaballs is really
> great, and more than what I'm usually capable of pulling off.
> That said, you might show where that approach can go wrong - or at least be
> picky in terms of distance and field strength.
> You might also consider using spheres or a mesh or a wireframe to show the basic
> structure - and then show how the blobs melt everything together.
>
> 8. A "Final" render, or a growing add-on scene.
> You have all of these various plants and creatures, but how about placing them
> into a nice scene to show them in context?
> It would be easy enough to make a simple beach scene and start adding modeled
> creature after modeled creature.  So every video gets an addition to a base
> scene.  Model 1 shell, then scatter 500 into the sand.  Model 1 beach grass
> plant, then plant a few hundred on a dune.  Add some radiosity and an HDR light
> probe, and the results can be dramatic.
> Sometime people will put a line of commented code at the top of their scene, to
> provide recommended command-line options for getting the best results for
> certain scenes.
>
> Gotta have some clever and entertaining ways to slip in those "like" and
> "subscribe" requests.  Written in the sand.  The pattern of shells on the beach.
>  An aerial banner or skywriting over the ocean.  A message in a bottle.   Go
> nuts.  ;)
>
> And as always, you can always solicit advice, code, textures, or scene files to
> use in your work.  Maybe throw some POV-Ray logos in there as well to show off
> your favorite script-driven raytracer.
>
> - Bill

Thanks for all this work! It'll take some time...

Thomas


Post a reply to this message

From: Paolo Gibellini
Subject: Re: Snail shells
Date: 16 Dec 2023 09:16:29
Message: <657db13d$1@news.povray.org>
Il 02/12/2023 22:43, Thomas Fester wrote:
> // Persistence of Vision Ray Tracer Scene Description File
> // File: ?.pov

A very nice and fast shell, Thomas!
It gives me the idea of xmas shells, with the proper texture.

Paolo


Post a reply to this message

From: Paolo Gibellini
Subject: Re: Snail shells
Date: 17 Dec 2023 19:47:51
Message: <657f96b7@news.povray.org>
Il 16/12/2023 15:16, Paolo Gibellini ha scritto:
> Il 02/12/2023 22:43, Thomas Fester wrote:
>> // Persistence of Vision Ray Tracer Scene Description File
>> // File: ?.pov
> 
> A very nice and fast shell, Thomas!
> It gives me the idea of xmas shells, with the proper texture.
> 
> Paolo

I mean something similar.
Sources in p.t.s.

Paolo


Post a reply to this message


Attachments:
Download 'xmas_shell_20231216_34.jpg' (112 KB)

Preview of image 'xmas_shell_20231216_34.jpg'
xmas_shell_20231216_34.jpg


 

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