Well, that's 99% finished. Copy the code below and paste into a new IGM file to test, material name is
. Don't forget to get a nice marble texture and change the path (currently:
) 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>