LDCad POVray export


LDCad POVray export
#1
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:

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!
Reply
« Next Oldest | Next Newest »



Messages In This Thread
LDCad POVray export - by Michael Horvath - 2018-02-17, 21:47
RE: LDCad POVray export - by Roland Melkert - 2018-02-18, 21:01
RE: LDCad POVray export - by Michael Horvath - 2018-02-18, 21:28
RE: LDCad POVray export - by Roland Melkert - 2018-02-18, 21:48
RE: LDCad POVray export - by Michael Horvath - 2018-02-18, 23:03
RE: LDCad POVray export - by Orion Pobursky - 2018-02-18, 23:31
RE: LDCad POVray export - by Michael Horvath - 2018-02-18, 23:43
RE: LDCad POVray export - by Orion Pobursky - 2018-02-18, 23:50
RE: LDCad POVray export - by Orion Pobursky - 2018-02-19, 2:05
RE: LDCad POVray export - by Michael Horvath - 2018-03-03, 12:18
RE: LDCad POVray export - by Philippe Hurbain - 2018-03-03, 13:10
RE: LDCad POVray export - by Roland Melkert - 2018-03-03, 18:06
RE: LDCad POVray export - by Roland Melkert - 2018-02-19, 18:34

Forum Jump:


Users browsing this thread: 1 Guest(s)