Marble tiles

General discussion about Indigo Materials - material requests, material developement, feedback, etc..
User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Marble tiles

Post by CTZn » Mon May 16, 2011 2:05 am

It will be one single phong material, using ISL for its albedo, bump and exponent.

I am already nearly done with the albedo: I would like to increase the randomness in tones distribution (currently dark and light tiles are grouped, depends on tiles frequency though), and add variance in the cement.

It will be easy for the user to customize the reference marble texture (a bitmap currently, wich is scanned over its two dimensions) and the number of tiles, horizontally and vertically. In effect, tiles don't have to be square.

Note that the result will be procedural, wich means that no texels will be visible no matter how close the shot will be.

Thanks to robostimpy for its artwork, and for encouraging us to make our own marble. That may be the matter for another ISL development thread, though not a simple one obviously (I'm reserving myself the right to fly away from that one :mrgreen: ).

Concerning an introduction to ISL, I mean to make it a brand different topic, to start with the basics (I just acquired).
Attachments
marbleTiles_Albedo-01_robostimpy-21-402_2.jpg
reference pic:
http://robostimpy.deviantart.com/art/Marble-21-402-188757389
Current albedo below
obsolete asset

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

Re: Marble tiles

Post by CTZn » Mon May 16, 2011 2:38 am

Below is the reference I used to discretize the fbm's:

http://www.digitalartform.com/archives/ ... tiled.html

Wich gives, under a rather expanded ISL form (and as used in the albedo above):

Code: Select all

	def slicesU() real : 16.0
	def slicesV() real : 24.0
		
	def discreteU() real :
		div(floor(mul(texi(), slicesU())), slicesU())
		
	def discreteV() real :
		div(floor(mul(texj(), slicesV())), slicesV())
		
	def outUV() vec2 :
		vec2(	discreteU() + u(),
				discreteV() + v()	)
		
	def marbleTiled() vec3 :
		sample2DTextureVec3(0, outUV())
NB: this code chunk is not functional alone, notably u() and v() are defined otherwhere.
obsolete asset

User avatar
suvakas
3rd Place Winner
Posts: 2613
Joined: Mon Sep 04, 2006 11:08 pm
Location: Estonia
Contact:

Re: Marble tiles

Post by suvakas » Mon May 16, 2011 3:15 am

Just awesome!
So CTZn, you got into ISL ? Very cool. 8)

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

Re: Marble tiles

Post by galinette » Mon May 16, 2011 3:37 am

If interested, I can make a marble texture to my procedural ceramic:

http://www.indigorenderer.com/materials/materials/286

That way, you will have the full randomized procedural bump + tile misplacement (tiles are procedurally not perfectly aligned, which improves a lot realism)
Eclat-Digital Research
http://www.eclat-digital.com

FoXar
Posts: 139
Joined: Wed Feb 23, 2011 9:57 pm

Re: Marble tiles

Post by FoXar » Mon May 16, 2011 3:55 am

Very interesting, I'll make sure to follow this topic! It's great to see what Indigo can do with procedural coded materials, it's quite unfortunate that it ain't simple..
Cheers,
Roo Evans


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

Re: Marble tiles

Post by CTZn » Mon May 16, 2011 6:44 am

If interested, I can make a marble texture to my procedural ceramic
We are of course, goodies, always !

As far as I'm concerned I want to keep understanding what I am doing or I wouldn't learn; I'm not getting your advanced code out of the box for the least (my math teachers all hated me, now I'm understanding it's because it was insulting that I couldn't understand their art. If some numbers ain't real then none are coz they're all numbers now let me alone ! I was ok at logic tho ;)), but yes I'll check closer at some point. I have that chance that marble is often of a straight cut (with a tiny, straight, 45° bevel tbh).

In the other hand Etienne I am interested in discussing you modelisation methods (I mean, in plain english to start with), I think you are able to place and orient each tile individually as you please while mines are only shaped by a straight grid. Did you start with pyramids ?

The most complicated thing I'll have to do for the current material will be to fit a flattish sinusoidal carving along the cement lines, I know I'll use the min() function to merge horizontal and vertical bands already. No joke I'll have to find the correlation out... please lemme do this ! But also Etienne, please do here as fun drives you !

Suvakas: yup thank you, and congrats about the new maxigo !
obsolete asset

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

Re: Marble tiles

Post by CTZn » Wed May 18, 2011 12:45 am

I'm currently trying to have more control on the shader, more pics tonight. Also I recon that the lack of a slope over tiles borders is not that great on bump mapping by a close shot, not sure what I can do myself about that.

Anyhow I'll have the material posted this week, I'd rather not be so perfectionist for a first try.

Oh and sorry about what I said on my maths teachers, they couldn't help that's all :twisted:
obsolete asset

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

Re: Marble tiles

Post by CTZn » Wed May 18, 2011 11:10 pm

As much as it was a nice mosaic, the variance in the tiles albedo made by no mean a realistic floor. So I am now trying to find a visual balance.

This is currently revealing more of the noises driving the features along with a cyclic nature from within my code. Two aspects I'll be working at. C&C's welcome !
Attachments
marbleTiles_test-02_chair.jpg
basic test
marbleTiles_test-03.jpg
Most recent version, same ref texture
obsolete asset

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

Re: Marble tiles

Post by CTZn » Sun May 22, 2011 5:16 pm

Well, that's 99% finished. Copy the code below and paste into a new IGM file to test, material name is tiledMarble. Don't forget to get a nice marble texture and change the path (currently: marble_21_402_by_robostimpy-d34dq4t.jpg) accordingly.

The number of tiles and cement width are easy to configure, however they must be changed into the three material parameters identically, with your lil fingers :)

Code: Select all

<?xml	version="1.0" encoding="utf-8" ?>
<scenedata>
	<material>
		<name>tiledMarble</name>
		<phong>
			<texture>
				 <uv_set>default</uv_set>
				 <path>
marble_21_402_by_robostimpy-d34dq4t.jpg
				 </path>
				 <a>0.0</a>
				 <b>1.0</b>
				 <c>0.0</c>
				 <exponent>2.2</exponent>
			</texture>
			
			<ior>1.52</ior>
			
			<exponent>
				<shader>
					<shader>
						<![CDATA[
						
	#	modify this block in exponent, bump, albedo
		def slicesX() real : 16.0
		def slicesY() real : 16.0
		def gridWidth() real :  0.01
	#	end custom bloc
			
		def eval(vec3 pos) real : 
		if(
			lt(
				min(
					fract(dot(vec2(slicesX(), 0.0), tex())),
					fract(dot(vec2(0.0, slicesY()), tex()))
				),
				gridWidth()
			),
			4.,
			(fbm(tex(), 12) + 1.)*3000.
		)
							
						]]>
					</shader>
				</shader>
			</exponent>
		
			<diffuse_albedo>
				<shader>
					<shader>
						<![CDATA[
						
#	modify this block in exponent, bump, albedo
		def slicesX() real : 16.0
		def slicesY() real : 16.0
		def gridWidth() real :  0.01
#	end custom bloc
		
#	albedo-specific edit bloc
		def scale() real : 8.
		def octaves() int : 16
#	end custom bloc
			
		def discretizeVec2(vec2 v2, real slicesX, real slicesY, real offsetX, real offsetY) vec2 :
			vec2(
				floor(doti(v2) * slicesX) / slicesX,
				floor(dotj(v2) * slicesY) / slicesY
			) + vec2(offsetX, offsetY)
			
		def tiledMarble() vec3 :
			sample2DTextureVec3(0,
				vec2(
					fbm((tex() + vec2(
							fbm(discretizeVec2(tex(), slicesX(), slicesY(),0.0,0.0), octaves()),
							fbm(discretizeVec2(tex(), slicesX(), slicesY(),1.25,1.25), octaves())
							)
						) * scale(), octaves()
					),
					fbm((tex() + vec2(
							fbm(discretizeVec2(tex(), slicesX(), slicesY(),2.5,2.5), octaves()),
							fbm(discretizeVec2(tex(), slicesX(), slicesY(),3.75,3.75), octaves())
							)
						) * scale(), octaves()
					)
				)
			)
			
	
		#	GRID
			
		def eval(vec3 pos) vec3 : 
		if(
			lt(
				min(
					fract(dot(vec2(slicesX(), 0.0), tex())),
					fract(dot(vec2(0.0, slicesY()), tex()))
				),
				gridWidth()
			),
			vec3(0.75, 0.68, 0.5),	# stripes color
			tiledMarble()			# tiles color
		)
							
						]]>
					</shader>
				</shader>
			</diffuse_albedo>
			
			<bump>
				<shader>
					<shader>
						<![CDATA[
						
	#	modify this block in exponent, bump, albedo
		def slicesX() real : 16.0
		def slicesY() real : 16.0
		def gridWidth() real : 0.01
	#	end custom bloc
						
		def pi() real : 3.14159265358979323846264338327950288419716939937
						
		#	BUMP: CEMENT
		
		def cementBump() real :
			(max(
				abs(noise(tex()*3000.)),
				 0.5
			) + abs(fbm(tex()*3000.,4))/40.) /800.	# 1m/800 = 1.25mm
	
		#	BUMP: GRID
		
		def eval() real : 
			if(
				lt(
					min(
						fract(dot(vec2(slicesX(),	0.0),	getTexCoords(0))),
						fract(dot(vec2(0.0, slicesY()),	getTexCoords(0)))
					),
					gridWidth()
				),
				cementBump(),
				0.002
			)
		*	neg(
				max(
					if(
						lt(
							fract(dot(vec2(slicesX(),	0.0),	getTexCoords(0))),
							gridWidth()
						),
						1.0,
						0.0
					)*sin(texi()* slicesX() *pi()*(recip(gridWidth()))),
					if(
						lt(
							fract(dot(vec2(0.0,	slicesY()),	getTexCoords(0))),
							gridWidth()
						),
						1.0,
						0.0
					)*sin(texj()* slicesY() *pi()*(recip(gridWidth())))
				)
			) + 1.
						
						]]>
					</shader>
				</shader>
			</bump>
			
		</phong>
	</material>
</scenedata>
Attachments
actual.jpg
Actual version
close-up.jpg
when it was 90% done... open sky, you'll do better.
obsolete asset

User avatar
pixie
Indigo 100
Posts: 2216
Joined: Sat Dec 29, 2007 4:54 am
Location: Away from paradise
Contact:

Re: Marble tiles

Post by pixie » Sun May 22, 2011 10:59 pm

:shock: Amazing work! Congrats!

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

Re: Marble tiles

Post by CTZn » Mon May 23, 2011 2:12 am

Thank you pixie, I appreciate it coming from an artist like you :)

If you are fancy editing the custom block, don't miss also the scale() parameter found in the diffuse_albedo, it will drastically change the look of the material:

Code: Select all

#	albedo-specific edit bloc
		def scale() real : 8.
		def octaves() int : 16
#	end custom bloc
For instance if you liked the variations found in the first posted picture, you can set it around 1.0 (0.5 or 1. or 2.5, whatever) A scale of 512. or more may still make sense depending on your taste. Don't remove the period though or you'll throw an integer, and that's not what the shader expects.

Talking about wich, the shader is more complex than it should; all this time I tried to bust an element of continuity between tiles to no avail... will update.

Comments and improvements from ISL writers are much welcome !
obsolete asset

User avatar
Doug Armand
Indigo 100
Posts: 1037
Joined: Fri May 16, 2008 5:49 pm
Location: London UK

Re: Marble tiles

Post by Doug Armand » Mon May 23, 2011 1:19 pm

Absolutely superb work CTZn! :D

am very envious of your ability to program shaders like this :(
Doug

Doug Armand

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

Re: Marble tiles

Post by CTZn » Mon May 23, 2011 5:04 pm

Well, I always loathed texels :oops: And again, a fair part of the result comes from the input texture.

Glad you like it Doug, thanks a lot !

I'll fiddle with a bit more the next days, I'm pretty sure some spp's can be saved, also I didn't evaluate the exponent bit.
obsolete asset

Mor4us
3rd Place Winner
Posts: 129
Joined: Mon Mar 07, 2011 5:46 am
Contact:

Re: Marble tiles

Post by Mor4us » Sat May 28, 2011 8:10 am

Hi guys,
I'm no Indigo user but always interested in new things ;)
This marble material looks awsome!!!! I've seen a lot of coding up there so i guess this is no simple bitmap material. Can you tell me something more about that indigo procedural materials? Is this an indigo-only thing or would it be possible to generate bitmaps out of it to use in cinema4d or some other 3D software?
Would really love to have this Material!!!

regards
C4D R20 Studio
mad-imagery.com

Post Reply
44 posts

Who is online

Users browsing this forum: No registered users and 0 guests