LDCad POVray export
2018-02-17, 21:47 (This post was last modified: 2018-02-17, 21:51 by Michael Horvath.)
2018-02-17, 21:47 (This post was last modified: 2018-02-17, 21:51 by Michael Horvath.)
A couple of observations.
1. slope bricks are not bumpy/grainy like they should be
2. at the POV-Ray newsgroups we came up with some code to add blurred reflections to models:
Unfortunately, there's no way to differentiate between ABS (solid) and Polycarbonate (clear) plastics. Could you add another column to the `ldColor` array for the `BlurAmount` value, in addition to `ior`? It would be great.
See also:
https://www.eurobricks.com/forum/index.p...e-realism/
http://news.povray.org/povray.binaries.i...ay.org%3E/
Thanks!
1. slope bricks are not bumpy/grainy like they should be
2. at the POV-Ray newsgroups we came up with some code to add blurred reflections to models:
Code:
// this methoid is slower
#macro BlurredReflectionMicroNormals(InPigment, InFinish, InNormal, BlurAmount, BlurSamples)
// texture
// {
average
texture_map
{
#declare iCount = 0;
#declare S = seed(0);
#while (iCount < BlurSamples)
[
1 // The pigment of the object:
pigment { InPigment }
// The surface finish:
finish { InFinish }
// This is the actual trick:
normal
{
average
normal_map
{
[1 bumps BlurAmount translate <rand(S),rand(S),rand(S)>*100 scale 0.001]
[1 InNormal]
}
}
]
#declare iCount = iCount + 1;
#end
}
// }
#end
// this method is faster, but requires a focal blur and/or extra antialiasing to smooth out the pixelation
#macro BlurredReflectionSingleNormals(InPigment, InFinish, InNormal, BlurAmount)
// texture
// {
pigment { InPigment }
finish { InFinish }
normal { InNormal }
normal {bumps BlurAmount scale 0.001}
// }
#end
#if (Use_BlurRef = true)
#ifndef (Use_BlurAmt) #declare Use_BlurAmt = 0.05; #end // amount of surface reflection blurring
#macro ldrawBuildTex(basePigment, baseNormal, baseFinish, pngIdx)
#if (pngIdx<0)
BlurredReflectionSingleNormals(basePigment, baseFinish, baseNormal, Use_BlurAmt)
#else
texture
{
pigment
{
uv_mapping
image_map
{
png getPngName(pngIdx)
getPngMapType(pngIdx)
interpolate 2
}
getPngWarp(pngIdx)
}
}
texture
{
BlurredReflectionSingleNormals(basePigment, baseFinish, baseNormal, Use_BlurAmt)
}
#end
#end
#else
#macro ldrawBuildTex(basePigment, baseNormal, baseFinish, pngIdx)
#if (pngIdx<0)
pigment { basePigment }
normal { baseNormal }
finish { baseFinish }
#else
#local texPigment= pigment
{
uv_mapping
image_map
{
png getPngName(pngIdx)
getPngMapType(pngIdx)
interpolate 2
}
getPngWarp(pngIdx)
}
#local result = texture
{
pigment { basePigment }
normal { baseNormal }
finish { baseFinish }
}
texture
{
pigment { texPigment }
}
result
#end
#end
#end
Unfortunately, there's no way to differentiate between ABS (solid) and Polycarbonate (clear) plastics. Could you add another column to the `ldColor` array for the `BlurAmount` value, in addition to `ior`? It would be great.
See also:
https://www.eurobricks.com/forum/index.p...e-realism/
http://news.povray.org/povray.binaries.i...ay.org%3E/
Thanks!