### Matt Benesi's Heightmap for Planes, Simplified

• 1 Replies
• 69 Views

0 Members and 1 Guest are viewing this topic.

#### Sabine62

• Moderator
• Posts: 971
• It's just a jump to the left...

#### Matt Benesi's Heightmap for Planes, Simplified

« on: August 09, 2020, 03:19:34 PM »
Based on Matt Benesi's MengerWorkOnHeightmap.frag, all I did was simplifying, adding a plane and a sphere, so all credit goes to Matt!

Goal is to use a heightmap with Fragmentarium's Floor, no luck until now
Something happens there already, but for now it goes...
Not sure it is possible at all...

Heightmap (1.jpg) in images below is created with JSPlacement, a free 'techy heightmap'-generator https://windmillart.net/?p=jsplacement

Update: added rotation of the heightmap

Code: [Select]
#info Heightmap by Matt Benesi, simplified, based on MengerWorkOnHeightmap.frag (Examples-folder)#info Place the code you want to combine with the plane in DE1#info Plane.w changes the height of the plane#info Align texturing to orientation of plane: ...htextoff+(z.xy) or (z.yz) or (z.xz)#define providesInit#include "MathUtils.frag"#include "DE-Raytracer.frag"#group Planeuniform vec4 Plane; slider[(-1,-1,-1,-10),(-1,-1,-1,0),(1,1,1,10)]uniform vec3 PlaneColor;color[1,1,1]uniform float Rotate;slider[-180,0,180]#group Sphereuniform float Sphere; slider[0,1,5]uniform vec3 Orientation;slider[(-10,-10,-10),(1,1,1),(10,10,10)]#group HeightMapuniform sampler2D tex;file[texture.jpg]uniform float hTextSpeedMult; slider[.01,8.34,20]uniform float hTextureSpeed; slider[-5,0.18,5]uniform float HighStrength; slider[-50,1.54,500]uniform vec4 hscale;slider[(-3,-3,-3,-3),(0.023,0,0,0),(3,3,3,3)]uniform vec2 hTextureOffset; slider[(-100,-100),(0,0),(100,100)]mat3 rot;void init() { vec3 Rotation=vec3(0.,0.,Rotate);        rot = rotationMatrixXYZ(Rotation);}void hTextureIT (inout vec3 z) {                z*=rot; vec2 horbittotal;  vec2 hangles; float htexturespeed=hTextureSpeed*hTextSpeedMult; float hintensity=HighStrength*.02; vec2 htextoff=hTextureOffset/100.0; vec4 hcolor = texture2D(tex, htextoff+(z.xy)*htexturespeed)*hintensity; hcolor.w=length(hcolor.xyz); float hh=dot(hcolor.xyz,hscale.xyz)+hscale.w*hcolor.w; z+=vec3(hh);}float DE1(vec3 z){vec3 o=Orientation; //plane and sphere by Inigo Quilez float sphere= length(z+=o)-Sphere; z-=o; return sphere;}float DE2(vec3 z){ hTextureIT(z); //plane and sphere by Inigo Quilez float plane=  dot(z,Plane.xyz) + Plane.w; return plane;}float DE(vec3 z){ float sph=DE1(z); float pl=DE2(z); return min(pl,sph);}#preset DefaultFOV = 0.4197531Eye = 4.6796472,-28.1975667,-9.20136941Target = 4.72089528,-26.1657297,-8.64092285Up = 0,0,-0.830732203EquiRectangular = falseAutoFocus = trueFocalPlane = 23.188406Aperture = 0.053557568Gamma = 1ToneMapping = 1Exposure = 1Brightness = 1.13456465Contrast = 1.8929504AvgLumin = 0.5,0.5,0.5Saturation = 1Hue = 0LumCoeff = 0.2125,0.7154,0.0721GaussianWeight = 1AntiAliasScale = 1.5DepthToAlpha = falseShowDepth = falseDepthMagnitude = 1Detail = -2.3DetailAO = -0.20535704FudgeFactor = 0.23797139MaxDistance = 372.8362MaxRaySteps = 211Dither = 0NormalBackStep = 1 NotLockedAO = 0,0,0,0.699999988Specular = 0.01419355SpecularExp = 66.534915SpecularMax = 10SpotLight = 1,0.490196078,0.490196078,0.58956277SpotLightDir = -0.62334218,-0.2679045CamLight = 1,0.905882353,0.866666667,0.52676056CamLightMin = 0.63756614Glow = 1,0.243137255,0.243137255,0.26538988GlowMax = 49Fog = 0.07017544HardShadow = 0.60000001 NotLockedShadowSoft = 1.5957446QualityShadows = falseReflection = 0.11067708 NotLockedDebugSun = falseBaseColor = 1,1,1OrbitStrength = 1X = 0.5,0.6,0.6,1Y = 1,0.6,0,0.9736148Z = 0.8,0.78,1,1R = 0.4,0.7,1,0.27608984BackgroundColor = 0.415686275,0.654901961,0.909803922GradientBackground = 1.13915415CycleColors = falseCycles = 0.1EnableFloor = falseFloorNormal = 0,0,-1FloorHeight = -4.7405966FloorColor = 1,1,1Plane = 0,0,-1,5.0125946PlaneColor = 0,0.266666667,1Sphere = 2.95226135Orientation = -4.8302872,0.2872064,2.4543082tex = 1.jpghTextSpeedMult = 0.572721096hTextureSpeed = 0.0141914HighStrength = 114.635763hscale = -1.04020098,1.5829146,0.15829146,0.1658292hTextureOffset = 0,0#endpreset

« Last Edit: August 09, 2020, 05:04:01 PM by Sabine62 »
To thine own self be true

#### Sabine62

• Moderator
• Posts: 971
• It's just a jump to the left...

#### Re: Matt Benesi's Heightmap for Planes, Simplified

« Reply #1 on: August 09, 2020, 03:20:51 PM »
With Knighty's take on pseudokleinian:

### Similar Topics

###### DE computation (simplified / pseudocode)

Started by lycium on Mandelbulber

6 Replies
319 Views
May 18, 2020, 11:01:56 PM
by lycium
###### Heightmap for Floor

Started by Sabine62 on Fragmentarium

4 Replies
405 Views
September 01, 2020, 06:34:43 PM
by Sabine62
###### Heightmap Hybrid

Started by Kalter Rauch on Fractal Image Gallery

2 Replies
168 Views
June 16, 2018, 07:35:51 PM
by Kalter Rauch
###### mandelbrot heightmap

Started by birational on Fractal Image Gallery

1 Replies
149 Views
August 28, 2018, 03:21:53 PM
by Bill Snowzell
###### Crazy Benesi Menger

Started by 3DickUlus on Fractal Image Gallery

0 Replies
143 Views
September 09, 2018, 10:32:02 PM
by 3DickUlus