Logo by AGUS - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Visit the official fractalforums.com Youtube Channel
 
*
Welcome, Guest. Please login or register. April 19, 2024, 01:47:10 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: A simple teapot isosurface  (Read 935 times)
0 Members and 1 Guest are viewing this topic.
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« on: November 13, 2016, 07:43:40 PM »

I found the Utah teapot shader on Shadertoy but it looked way too complicated for me.
So I thought that it might be redesigned using far less constants, routines and stuff, of course using more simple shapes! cheesy
But it still looks pretty realistic.
The code reported here must be shadertoy-ized a little but the hardest work is done; cheesy

Code:
// Teapot lame isosurface code is released under CC BY-SA 3.0
// Original release 13-11-2016 by DarkBeam at Fractalforums
// all variables must be declared, and set to 0
// (except x,y,z) at the beginning and must be public
// but I suggest to merge everything in an unique routine

DE {
  DEt = teabody();
  if (DEt >1.8) return DEt; // speedup
  DEx = min(spout(),handle());
  DEx = max(DEx,-teahole);
  DEt = min(DEx,DEt); // you might use a smooth min() here
  return max(DEt,-spouthole);
}


teabody {
   // Just some circles stitched together (more or less :P )
   r = x*x+y*y; r = sqrt(r);
   cut0=z-1.8;
   if (cut0>0.0) {
     xtp=r-.6145898;
     return sqrt(cut0*cut0+r*r)-.015;
   } else {
     cut2=2*r-z-0.1;
     cut2=max(cut2,-z+.8);
     if (cut2>0) {
       xtp=-r+.45;
       xtp=0.5*(xtp-abs(xtp));
       ztp=cut0+1.;
       xtp=xtp*xtp; ztp=ztp*ztp;
       w=sqrt(xtp+ztp)-.782623792;
     }else {
       xtp=r-0.95;ztp=cut0;
       xtp=xtp*xtp; ztp=ztp*ztp;
       w=sqrt(xtp+ztp)-.3354102; w = -w;
     }
     teahole=w;
     return abs(w)-.015;
     }  
}

spout {
  xtp = x-.94; ztp=z-.7;
  v = .707106 (xtp+ztp);  u = .707106 (xtp-ztp);
  // v*v causes DE trouble but not in this small interval
  // else modify the v multipliers
  t = sqrt(u*u+y*y*1.6)-.3+.311*v-.12*(v*v);
  t = max (t,abs(v-.7)-.7 );
  spouthole = t;
  t = abs(t-.015)-.015);
  t = max (t,z-1.5 );
  return t;
}

handle {
   cut0=z-1.21;
   if (cut0>0.0) {
     xtp=x+1.11; xtp=xtp*xtp;
     ztp=cut0*cut0;
     w=sqrt(xtp+ztp)-.3354102;
   } else {
     xtp=x+0.6; xtp=xtp*xtp;
     ztp=cut0*cut0;
     w=sqrt(xtp+ztp)-.9454102;
   }
   return sqrt(w*w+y*y)-.1;
}
« Last Edit: November 13, 2016, 09:01:33 PM by DarkBeam » Logged

No sweat, guardian of wisdom!
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #1 on: November 13, 2016, 07:54:39 PM »

  Good job Luca!

  initialize variables somewhere? 
Logged

DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #2 on: November 13, 2016, 07:56:55 PM »

Thanks Matthew kiss but let me attach a preview embarrass


* teapot.jpg (36.27 KB, 1168x377 - viewed 111 times.)
Logged

No sweat, guardian of wisdom!
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #3 on: November 13, 2016, 08:00:43 PM »

Looks like texture is not attached to normals on the object, but instead to something else?  First one is nice!
Logged

DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #4 on: November 13, 2016, 08:23:59 PM »

Well I don't know it is a mb3d lightmap (the actual iso is clean) smiley the second is a cut view that shows the inside and the holes all around smiley
Also yes all vars are float and you must declare and initialize them!
I programmed all in assembly (where vars ... don't exist  grin ) this is a transcript that hopefully is not too messy!!!
« Last Edit: November 13, 2016, 08:32:18 PM by DarkBeam » Logged

No sweat, guardian of wisdom!
Sabine
Fractal Fertilizer
*****
Posts: 373



WWW
« Reply #5 on: November 13, 2016, 08:26:39 PM »



You did it, Luca!!! You're my hero  Yes !!
Logged

sabine62.deviantart.com
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Simple 2D IFS animation Movies Showcase (Rate My Movie) David Makin 0 1973 Last post December 09, 2006, 11:41:48 PM
by David Makin
Simple 3D IFS in POV-Ray IFS - Iterated Function Systems utak3r 1 8367 Last post March 19, 2010, 08:16:44 AM
by Nahee_Enterprises
The dribbleless teapot Mandelbulb3D Gallery Dermis 0 640 Last post January 06, 2013, 07:52:40 PM
by Dermis
3d isosurface rendering program from Ryan Geiss 3D Fractal Generation Mrz00m 2 6705 Last post January 22, 2015, 12:47:56 PM
by DarkBeam
supershape as an isosurface (now dancing) General Discussion DarkBeam 11 2589 Last post January 29, 2015, 05:02:46 PM
by eiffie

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.165 seconds with 25 queries. (Pretty URLs adds 0.007s, 2q)