Voronoi ISL Shader

General questions about Indigo, the scene format, rendering etc...
User avatar
Doug Armand
Indigo 100
Posts: 1038
Joined: Fri May 16, 2008 5:49 pm
Location: London UK

Re: Voronoi ISL Shader

Post by Doug Armand » Tue May 31, 2011 9:18 pm

OnoSendai wrote:Implemented a basic Voronoi function.
Messing around with it:
The ones with rings are based on pulse()ing the distance from the voronoi cell points. There's also 4 scales of Voronoi regions mixed together :)
Will these be easily accessible to a shader nublet like me without needing a maths degree? :wink:
If so then that will be great indeed
Doug

Doug Armand

User avatar
OnoSendai
Developer
Posts: 6241
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Re: Voronoi ISL Shader

Post by OnoSendai » Tue May 31, 2011 9:46 pm

Doug Armand wrote:
OnoSendai wrote:Implemented a basic Voronoi function.
Messing around with it:
The ones with rings are based on pulse()ing the distance from the voronoi cell points. There's also 4 scales of Voronoi regions mixed together :)
Will these be easily accessible to a shader nublet like me without needing a maths degree? :wink:
If so then that will be great indeed
Yes, we've been working on that as well. Will post some details soon.

User avatar
galinette
1st Place Winner
Posts: 923
Joined: Sat Jan 09, 2010 1:39 am
Location: Nantes, France
Contact:

Re: Voronoi ISL Shader

Post by galinette » Tue May 31, 2011 11:38 pm

Hello,

If you want, I can try to explain my shader. It gives a result quite different than these

Etienne
Eclat-Digital Research
http://www.eclat-digital.com

User avatar
OnoSendai
Developer
Posts: 6241
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Re: Voronoi ISL Shader

Post by OnoSendai » Wed Jun 01, 2011 12:13 am

Hi Etienne,
That's fine thanks.
These pictures are from 'fractal' Voronoi regions, e.g. a sum of voronoi regions of different scales.

User avatar
OnoSendai
Developer
Posts: 6241
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Re: Voronoi ISL Shader

Post by OnoSendai » Wed Jun 01, 2011 12:50 am

Here's a visualisation of the basic voronoi noise, with the code:

Code: Select all

def scaledVoronoiDist(vec2 p, real scale) real :
  dist(p * scale, voronoi(p * scale, 1.0))
  
def eval(vec3 pos) vec3 :
  vec3(scaledVoronoiDist(getTexCoords(0), 10.0))
You can see the underlying grid pattern, which I will do some work to get rid of soon.
Attachments
voronoi_shader_test.jpg

User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Re: Voronoi ISL Shader

Post by CTZn » Wed Jun 01, 2011 1:32 am

Very nice, so we can map the cells size... some control over randomness might be of use too.

Looking forward for these improvements in accessibility you are talking about, I'm wondering wether that may concern sharing of code snippets :)
obsolete asset

User avatar
OnoSendai
Developer
Posts: 6241
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Re: Voronoi ISL Shader

Post by OnoSendai » Wed Jun 01, 2011 2:03 am

You will be able to define shader 'parameters' like so, which will then be available in your shader as pre-defined functions:

We're still working on the code, we'll make a fuss about it when it's done, because it should be pretty cool, and should finally make shaders easily tweakable by artists :)

Code: Select all

	<albedo>
				<shader>
          <param>
            <colour3>
              <name>BrickBaseColour</name>
              <description>Base colour for the brick.</description>
              <value>0.6 0.2 0.2</value>
            </colour3>
          </param>

          <param>
            <colour3>
              <name>GroutBaseColour</name>
              <description>Base colour for the grouting.</description>
              <value>0.5 0.5 0.5</value>
            </colour3>
          </param>
          
          <param>
            <real>
              <name>BrickColourVariation</name>
              <description></description>
              <min>0</min>
              <max>1.0</max>
              <value>0.3</value>
            </real>
          </param>

					<shader>
						<![CDATA[	
						   
def brickColour() vec3 : 
  paramBrickBaseColour() + 
  vec3(
    noise(vec2(0.5 + brickXNum() * 10.0, 0.5 + brickYNum() * 10.0)) * paramBrickColourVariation(), 
    0.0, 
    0.0
  )
  
def groutColour() vec3 : 
  paramGroutBaseColour()

def eval(vec3 pos) vec3 :
  if(
    (brickX() < grout()) || 
    (brickY() < grout()) ||
    (brickX() > (paramBrickWidth() - grout())) || 
    (brickY() > (paramBrickHeight() - grout()))
    ,
    groutColour(),
    brickColour()
  )
						]]>
					</shader>
				</shader>
			</albedo>
Attachments
shader_params.jpg

User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Re: Voronoi ISL Shader

Post by CTZn » Wed Jun 01, 2011 10:49 am

Mmmh tasty, I remember about that one now. Is this something that will be able [for] use early ?
obsolete asset

mspaw
Posts: 5
Joined: Mon Mar 19, 2012 1:53 pm

Re: Voronoi ISL Shader

Post by mspaw » Mon Mar 19, 2012 2:03 pm

Etienne-

Im working on a voronoi map as well and wondering if you would be willing to share how you are getting the rounded corners on your stones. Ive been playing with any number of combinations of the feature points but have yet to figure out how you achieve the rounded appearance. Any help would be great.

Thanks!

-Michael

User avatar
galinette
1st Place Winner
Posts: 923
Joined: Sat Jan 09, 2010 1:39 am
Location: Nantes, France
Contact:

Re: Voronoi ISL Shader

Post by galinette » Thu Mar 22, 2012 10:49 pm

Hi,

Yes, I can share the shader! I have to look at home and find back the file... It was quite complex

I can remember the principle behind it.

If you want to model a pyramid in ISL, you can decribe it like that:
- Find the equation z(u,v) of each 4 planes of the pyramid
- If you take for any point the minimum of these 4 equations, you have a procedural pyramid

Now, instead of the min function, just take a softmin. You will get a rounded pyramid. This is basically how I make the ceramic tiles in a database material.

The rounded stones works similarly, but for this I need to make voronoi pyramids instead of voronoi cells. The pyramid panes are defined by the distance to the closest voronoi cell edge. This was a pretty big ISL shader...

Etienne
Eclat-Digital Research
http://www.eclat-digital.com

mspaw
Posts: 5
Joined: Mon Mar 19, 2012 1:53 pm

Re: Voronoi ISL Shader

Post by mspaw » Fri Mar 23, 2012 4:29 am

Etienne-

Id love to see the codes for sure. I'm wondering if it can be made into a 3d solid procedural? It sounds like if I already have a voronoi function I need to check the point to be shaded against all the edges and do a soft min, if I understand correctly? Id love to see what that might look like in C++ but if you have a working version I may be able to tease out the rest. The trick I gather is building up a sum of all the boundaries.

Looking forward to it!

Thanks

-Michael

User avatar
galinette
1st Place Winner
Posts: 923
Joined: Sat Jan 09, 2010 1:39 am
Location: Nantes, France
Contact:

Re: Voronoi ISL Shader

Post by galinette » Fri Mar 23, 2012 4:50 am

What do you mean by 3D solid procedural?

In fact, it is not easy to start from a voronoi func to compute the distance to edges. It is more easy to build a "voronoi pyramids" function from scratch.

Of course, it should be doable in C++, which is much more flexible than ISL!

Etienne
Eclat-Digital Research
http://www.eclat-digital.com

mspaw
Posts: 5
Joined: Mon Mar 19, 2012 1:53 pm

Re: Voronoi ISL Shader

Post by mspaw » Fri Mar 23, 2012 5:53 am

Im actually working on a map for 3ds max. By solid procedural i mean a map that takes a XYZ input vs UV and computed the value in 3d space. I gather yours is in UV space?

Yeah computing the boundaries is a trick but it should be doable.

-Michael

mspaw
Posts: 5
Joined: Mon Mar 19, 2012 1:53 pm

Re: Voronoi ISL Shader

Post by mspaw » Fri Mar 30, 2012 4:29 am

Etienne-

Any luck digging out the code?

Thanks!

-Michael

User avatar
galinette
1st Place Winner
Posts: 923
Joined: Sat Jan 09, 2010 1:39 am
Location: Nantes, France
Contact:

Re: Voronoi ISL Shader

Post by galinette » Sun Apr 01, 2012 8:53 am

Hi!

Please find the materials attached.
pyra is more a base shader for you to understand how to make some interesting effects
stones is the stone material. It is unfinished and ugly, but all the base code is there. All it needs is artistic optimization...

I will have less and less time to work on these free-time things now : I am the father of a little girl named Augustine since yesterday evening! I will continue the work on coated glass though (this is not free time but work time!)

Regards,

Etienne
Attachments
stones.pigm
(1.2 MiB) Downloaded 222 times
pyra.igm
(2.63 KiB) Downloaded 229 times
Eclat-Digital Research
http://www.eclat-digital.com

Post Reply
87 posts

Who is online

Users browsing this forum: No registered users and 30 guests