Logo by Dinkydau - 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: Support us via Flattr FLATTR Link
 
*
Welcome, Guest. Please login or register. April 19, 2024, 03:41:19 AM


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] 2   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: Pixelated sphere DE?  (Read 3994 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 29, 2015, 11:59:12 PM »

I wanted to realize a sphere that looks like pixelated (Minecraft like)...
Without slow methods like "place one cube then another one ..." and a smooth distance estimation. Possible? Knighty if you have some time wink
« Last Edit: November 30, 2015, 12:25:59 AM by DarkBeam » Logged

No sweat, guardian of wisdom!
lycium
Fractal Supremo
*****
Posts: 1158



WWW
« Reply #1 on: November 30, 2015, 03:07:27 AM »

Just about to head to bed, but had an idea - is it maybe possible to find the closest cube (pretty easy), and use the DE for that?
Logged

Patryk Kizny
Global Moderator
Fractal Fertilizer
******
Posts: 372



kizny
WWW
« Reply #2 on: November 30, 2015, 10:54:57 AM »

I would try to use modulo for that so just modulo something small (your pixel) and limit it with the sphere volume (length(v) < R)
Logged

Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
zebastian
Conqueror
*******
Posts: 121



« Reply #3 on: November 30, 2015, 01:14:44 PM »

@Patryck: i think a modulo on the view vector will cubify not to the global grid, but only quantify length in view direction.
Anyway, if we map every found point on the sphere surface to the rasterized grid (find nearest cube) we could calculate the distance to this cube.
This will have the upside, that this method will work on different kinds of surfaces (but surfaces will need to be smooth)
What do you think?

Here some pseudo code:

double distToSphere = getDistanceToSphere(cameraPosition ...);
CVector3 hitSphere = cameraPosition + normalizedViewVector * dist;
CVector3 centerHitCube = hitSphere - (hitSphere.mod(cubeDimension));
double distToCube = getDistanceToCube(centerHitCube...);
return distToCube;
« Last Edit: November 30, 2015, 02:15:50 PM by zebastian » Logged
lycium
Fractal Supremo
*****
Posts: 1158



WWW
« Reply #4 on: November 30, 2015, 02:21:45 PM »

is it maybe possible to find the closest cube (pretty easy), and use the DE for that?

Anyway, if we map every found point on the sphere surface to the rasterized grid (find nearest cube) we could calculate the distance to this cube.

 afro
Logged

zebastian
Conqueror
*******
Posts: 121



« Reply #5 on: November 30, 2015, 03:16:44 PM »

 grin oh yeah, thats pretty much it
i just wanted to give an example, how to integrate this into the calculation.

A more interesting question is:
Can we find a way to get a cube which is constant for all view vectors hitting the cube (for arbitrary surfaces).
If the surface is disturbed two view vectors close to each other should hit the same cube, but one may be more than boxSize away, so the boxes will have holes
Logged
lycium
Fractal Supremo
*****
Posts: 1158



WWW
« Reply #6 on: November 30, 2015, 04:00:32 PM »

might be necessarily to check the neighbour blocks (also ensuring that their centre is still < radius).
Logged

Aexion
Conqueror
*******
Posts: 116


The Fractal Hermit


WWW
« Reply #7 on: November 30, 2015, 04:28:56 PM »

You can just simulate low resolution coordinates:
Code:
double Sphere(double x,double y,double z){
x*=45;
y*=45;
z*=45;
x=int(x);
y=int(y);
z=int(z);
x/=45;//just for clarification
y/=45;
z/=45;
const double a=sqrt(x*x+y*y+z*z)-1;
return (a);
}



* boxsphere.jpg (46.99 KB, 512x512 - viewed 324 times.)
« Last Edit: November 30, 2015, 04:50:48 PM by Aexion » Logged

Fractals all the way..
Incendia for 3D Fractals
Aural for Musical Fractals
Buddhi
Fractal Iambus
***
Posts: 895



WWW
« Reply #8 on: November 30, 2015, 05:55:40 PM »

Nice. I have also looked for it. Thanks for sharing this function.
Logged

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


Fragments of the fractal -like the tip of it


« Reply #9 on: November 30, 2015, 06:43:15 PM »

Wow interesting solution Ramiro! It is not the correct one (no discontinuity) I was looking for but should work! wink Still if someone has the smooth solution please post ok. A Beer Cup
Logged

No sweat, guardian of wisdom!
zebastian
Conqueror
*******
Posts: 121



« Reply #10 on: December 01, 2015, 06:52:24 PM »

great idea aexion, this works quite good on all kinds of primite objects.
i did some tests in mandelbulber, see screenshot attached.
only change was adding this to modify the position of the surface point, before calculation of the distance:

point.x = ((int)(point.x * 10)) / 10.0;
point.y = ((int)(point.y * 10)) / 10.0;
point.z = ((int)(point.z * 10)) / 10.0;

@buddhi, what do you think about adding another modifier for this?


* image.png (217.1 KB, 1600x400 - viewed 236 times.)
Logged
knighty
Fractal Iambus
***
Posts: 819


« Reply #11 on: December 11, 2015, 05:29:36 PM »

interesting!
If it is just for a sphere, it should be possible. Something like what lycium suggested.
The only general solution I could think about is exactly the one you want to avoid. No miracle! smiley
Anyway! One can still use DDA when close to the surface.
There is a very cool shadertoy toy out there with a voxelized pac man that mainly uses DE.
Logged
knighty
Fractal Iambus
***
Posts: 819


« Reply #12 on: December 15, 2015, 01:28:23 PM »

Ok! here is my attempt.
It comes with a sphere but it can be used for any DE. The method is general and costly: more than 27 evaluations of the base DE.
It can be optimized for convex objects: If one have the gradient of the base DE then it is not necessary to check for 27 cells, only 8.

... And of course use the base DE when far from the object...

* voxel00.zip (1.73 KB - downloaded 105 times.)
« Last Edit: December 15, 2015, 01:50:06 PM by knighty » Logged
knighty
Fractal Iambus
***
Posts: 819


« Reply #13 on: December 15, 2015, 01:48:20 PM »

BTW!
A little bit off topic but related. This excellent shader by eiffie: https://www.shadertoy.com/view/llf3z8
also: https://www.shadertoy.com/view/Xlf3zf
Logged
Aexion
Conqueror
*******
Posts: 116


The Fractal Hermit


WWW
« Reply #14 on: January 14, 2016, 02:17:56 PM »

If anyone is interested, here's the hexagonal (honeycomb) version:

It basically transforms the (x,z) coordinates into the hexagonal (q,r) coordinates, then transforms it again to (x,z).
This wasn't easy to guess at first, I tried a lot of formulas and combinations until I comes with this solution.
Is not perfect, but its a good start. The code is unoptimized, but that's because I want to make it very clear.

Code:
double HexSphere(double x,double y,double z){
x*=0.6;//scaling.. don't ask..
x*=45;//45 hexagons by unit
y*=45;
z*=45;
y=int(y);
//converts (x,z) to (r,q)
const double temp = floor(x + z);
const double r = floor((floor(z - x) + temp) / 3.0);  
const double q = floor((floor(2 * x + 1) + temp) / 3.0) - r;
x = 3.0/2.0 * r;  //turns back, r q to x z
z = sqrt(3.0) * (q + r/2.0);
x/=45.0;//just for clarification
y/=45.0;
z/=45.0;
const double a=sqrt(x*x+y*y+z*z)-1;
return (a);
}

For more info on hexagonal coordinates, this is a good source: http://www.redblobgames.com/grids/hexagons/

Hope you like it.. smiley

 


* hex1.jpg (42.01 KB, 512x512 - viewed 418 times.)

* hex2.jpg (27.03 KB, 512x512 - viewed 255 times.)

* hex3.jpg (41.99 KB, 512x512 - viewed 258 times.)
« Last Edit: January 14, 2016, 09:44:37 PM by Aexion » Logged

Fractals all the way..
Incendia for 3D Fractals
Aural for Musical Fractals
Pages: [1] 2   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Light Sphere Mandelbulb3D Gallery Lee Oliver 0 1158 Last post March 09, 2011, 11:34:53 PM
by Lee Oliver
Sphere Images Showcase (Rate My Fractal) Imagyx 0 1470 Last post September 22, 2011, 11:37:10 PM
by Imagyx
Rendering is pixelated Help & Support Doombringer 5 271 Last post September 24, 2014, 11:02:00 PM
by Sockratease
Sphere in a sphere in a sphere Mandelbulb3D Gallery MichaelWGioffredi 0 1048 Last post September 28, 2015, 10:33:49 PM
by MichaelWGioffredi
Pixelated Navigator Mandelbulb 3d crua 0 1376 Last post November 10, 2016, 03:01:42 AM
by crua

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.156 seconds with 25 queries. (Pretty URLs adds 0.011s, 2q)