Page 2 of 6

Re: Voronoi ISL Shader

Posted: Fri Oct 08, 2010 4:51 am
by CTZn
A straight border between cells you mean ? Look, this base shader is already a great thing. Then, shifting the UVs with another noise func plus a simple condition with the displaced distance as input would be enough in most cases. With a fbm at a matching frequency, one can trick tiles into variated shades (works better with large gaps though)... but, bring us all the candy you want with :)

Image
source: http://www.google.com/imgres?imgurl=htt ... CDoQ9QEwBw

Looking at those fruits, I'm noticing that the point value is dependent on the e:smallest cell dimension... hihi.

Re: Voronoi ISL Shader

Posted: Fri Oct 08, 2010 5:07 am
by pvbeeber
This is great. Galvanized metal would be a good application.

Re: Voronoi ISL Shader

Posted: Fri Oct 08, 2010 7:58 pm
by snorky
i try voronoi on my bathroom glass door, i fail:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<scenedata>
	<medium>
		<name>v1_medium</name>
		<precedence>2</precedence>
		<basic>
			<ior>1.5</ior>
			<cauchy_b_coeff>0</cauchy_b_coeff>
			<absorption_coefficient_spectrum>
				<rgb>
					<rgb>
						41.6496 41.6496 10.1429
					</rgb>
					<gamma>1</gamma>
				</rgb>
			</absorption_coefficient_spectrum>
		</basic>
	</medium>
	<material>
		<name>v1</name>
		<specular>
			<internal_medium_name>v1_medium</internal_medium_name>
			<transparent>true</transparent>
			<absorption_layer_transmittance>
				<shader>
					<shader><![CDATA[def mypos() vec2:
	getTexCoords(0)*10.

def tile(vec2 mypos) vec2:
	vec2(
		floor(doti(mypos)), 
		floor(dotj(mypos))      )

def node(vec2 tile) vec2:
	tile + vec2 ( noise(tile*1.456169584),  noise(tile*1.65465165) )

def closest(vec2 node_a, vec2 node_b, vec2 xy) vec2:
	vec2(
		if(
			lt(
				length(node_a - xy), 
				length(node_b - xy)
			),
			doti(node_a),
			doti(node_b)
		),
		if(
			lt(
				length(node_a - xy), 
				length(node_b - xy)
			),
			dotj(node_a),
			dotj(node_b)
		)
	)

		
def voronoi(vec2 curtile, vec2 xy) vec2:
	closest(
	closest(
	closest(
	closest(
	closest(
	closest(
	closest( 
	closest( node(curtile), node(curtile + vec2(1.,0.)) , xy )
	,  node(curtile + vec2(1.,1.)), xy )
	,  node(curtile + vec2(0.,1.)), xy )
	,  node(curtile + vec2( -1. ,1.)), xy )
	,  node(curtile + vec2( -1. ,0.)), xy )
	,  node(curtile + vec2( -1., -1.)), xy )
	,  node(curtile + vec2( 0., -1. )), xy )
	,  node(curtile + vec2( 1., -1. )), xy )


def color(vec2 pt) vec3:
	vec3(fract(doti(pt)), fract(dotj(pt)), 1.)

def eval(vec3 pos) vec3 :
	color(voronoi(tile(mypos()), mypos()))]]></shader>
				</shader>
			</absorption_layer_transmittance>
			<displacement>
				<shader>
					<shader><![CDATA[def eval() real :
	0.00 # Return zero displacement/bump
def mypos() vec2:
	getTexCoords(0)*10.

def tile(vec2 mypos) vec2:
	vec2(
		floor(doti(mypos)), 
		floor(dotj(mypos))      )

def node(vec2 tile) vec2:
	tile + vec2 ( noise(tile*1.456169584),  noise(tile*1.65465165) )

def closest(vec2 node_a, vec2 node_b, vec2 xy) vec2:
	vec2(
		if(
			lt(
				length(node_a - xy), 
				length(node_b - xy)
			),
			doti(node_a),
			doti(node_b)
		),
		if(
			lt(
				length(node_a - xy), 
				length(node_b - xy)
			),
			dotj(node_a),
			dotj(node_b)
		)
	)

		
def voronoi(vec2 curtile, vec2 xy) vec2:
	closest(
	closest(
	closest(
	closest(
	closest(
	closest(
	closest( 
	closest( node(curtile), node(curtile + vec2(1.,0.)) , xy )
	,  node(curtile + vec2(1.,1.)), xy )
	,  node(curtile + vec2(0.,1.)), xy )
	,  node(curtile + vec2( -1. ,1.)), xy )
	,  node(curtile + vec2( -1. ,0.)), xy )
	,  node(curtile + vec2( -1., -1.)), xy )
	,  node(curtile + vec2( 0., -1. )), xy )
	,  node(curtile + vec2( 1., -1. )), xy )


def color(vec2 pt) vec3:
	vec3(fract(doti(pt)), fract(dotj(pt)), 1.)

def eval(vec3 pos) vec3 :
	color(voronoi(tile(mypos()), mypos()))]]></shader>
				</shader>
			</displacement>
			<layer>0</layer>
		</specular>
	</material>

</scenedata>
can you find the problem?
thanks

Re: Voronoi ISL Shader

Posted: Fri Oct 08, 2010 11:06 pm
by triplej28
I was going to integrate voronoi glazing panels into the design of my latest building facade.. This would perhaps made the visualization process alot easier.

Instead I made 1800 custom panels from Grasshopper in Rhino.

I can see lots of cool things you can do with this in the architecture world :D

my 2c

Re: Voronoi ISL Shader

Posted: Wed Nov 03, 2010 11:18 pm
by galinette
Hi triplej28,

I'm working in the glass facade business, and that looks like a nightmare for the glass processor and the facade assembler :D

Here is a small update of my development of the ISL shader.

Re: Voronoi ISL Shader

Posted: Thu Nov 04, 2010 12:53 am
by CTZn
That's very cool Etienne !

I'm refraining from throwing more random ideas based on your work, go go go go ^^

You were prized already but I must say that your material board is great.

Re: Voronoi ISL Shader

Posted: Thu Nov 04, 2010 12:55 am
by galinette
The letchee is baking....

I'm also working on a stained glass

Re: Voronoi ISL Shader

Posted: Thu Nov 04, 2010 12:59 am
by CTZn
galinette wrote:The letchee is baking....
Aw... now that's seduction :lol:

Nice pick with stained glass !

Re: Voronoi ISL Shader

Posted: Thu Nov 04, 2010 1:24 am
by galinette
That's inspiration and challenge... :wink:

Re: Voronoi ISL Shader

Posted: Thu Nov 04, 2010 2:01 am
by dakiru
galinette wrote:That's inspiration and challenge... :wink:
Yummy Indigo lychee :)

Re: Voronoi ISL Shader

Posted: Thu Nov 04, 2010 2:04 am
by CTZn

Re: Voronoi ISL Shader

Posted: Sat Nov 06, 2010 11:42 pm
by galinette
Just a little update with displacement:

Re: Voronoi ISL Shader

Posted: Sun Nov 07, 2010 1:38 am
by CTZn
Nicely scaled for rustic water places: public baths, a fountain or something akin, even for some low-grade garden sculptures :)

Comment for my previous post should be: "for inspiration and challenge", I don't want to let you think it was a request or something else. I'm assuming that ISL may not make nested cells levels easy to set on the fly.

You Sir, are inspiring !

Re: Voronoi ISL Shader

Posted: Sun Nov 07, 2010 11:19 pm
by galinette
Still under development

Re: Voronoi ISL Shader

Posted: Mon Nov 08, 2010 2:12 am
by Headroom
WOW :shock: :shock:
Breathtaking!