# HG changeset patch # User Leonard Ritter # Date 1639319136 -3600 # Sun Dec 12 15:25:36 2021 +0100 # Node ID 9220c246c2dacd924de4a862e1a67da71a25f5ad # Parent 608617aeb34a915e4fe9fa74cb7485084ece6e5e * initial work on subjective filtering diff --git a/lib/tukan/VertexPainter.sc b/lib/tukan/VertexPainter.sc --- a/lib/tukan/VertexPainter.sc +++ b/lib/tukan/VertexPainter.sc @@ -55,7 +55,7 @@ active_lightdir = (vec3 0 0 1) active_color = (vec4 1) - let MaxVertexCount = 16384 + let MaxVertexCount = 1000000 let SwapBufferCount = 1 let PrimArray = (Array vec4) diff --git a/lib/tukan/sdf.sc b/lib/tukan/sdf.sc --- a/lib/tukan/sdf.sc +++ b/lib/tukan/sdf.sc @@ -294,6 +294,9 @@ 0.0 r +inline sdDomainRep (p c) + p := (mod (p + 0.5 * c) c) - 0.5 * c + fn sdSmoothOr (a b r) #float <- (float float float) let e = (srange a b r) @@ -493,4 +496,5 @@ let sdOr sdAnd sdSub sdBezier let sdSmoothOr sdSmoothAnd let sdMaterial sdmDist + let sdDomainRep locals; diff --git a/testing/test_mt.sc b/testing/test_mt.sc --- a/testing/test_mt.sc +++ b/testing/test_mt.sc @@ -12,29 +12,32 @@ one tet is handled per thread -import ..tukan.voxel -let voxel = tukan.voxel using import glm using import glsl using import Array using import Box using import struct -using import ..tukan.gl -using import ..tukan.bitmap -using import ..tukan.packing -using import ..tukan.random -using import ..tukan.color -using import ..tukan.perfect_hash -using import ..tukan.raytrace -using import ..tukan.sdf -using import ..tukan.sdl -using import ..tukan.rotation -using import ..tukan.brdf -using import ..tukan.normal -using import ..tukan.projection -using import ..tukan.derivative -using import ..tukan.isosurface +import ..lib.tukan.use + +import tukan.voxel +let voxel = tukan.voxel + +using import tukan.gl +using import tukan.bitmap +using import tukan.packing +using import tukan.random +using import tukan.color +using import tukan.perfect_hash +using import tukan.raytrace +using import tukan.sdf +using import tukan.sdl +using import tukan.rotation +using import tukan.brdf +using import tukan.normal +using import tukan.projection +using import tukan.derivative +using import tukan.isosurface using import .testfragment # reserve 10MB for each voxel buffer @@ -676,11 +679,11 @@ global cell_buffers = arrayof GL.uint - GL.CreateBuffer; - GL.CreateBuffer; - GL.CreateBuffer; - GL.CreateBuffer; - GL.CreateBuffer; + GL.Buffer; + GL.Buffer; + GL.Buffer; + GL.Buffer; + GL.Buffer; let cell_buffer_sz = ((sizeof u32) * (1 + MAX_VOXELS)) for i in (range (NUM_BUFFERS as u32)) let buf = (cell_buffers @ i) @@ -697,7 +700,7 @@ #global tx_position_normal = (GL.CreateTexture GL.TEXTURE_BUFFER) #GL.TextureBuffer tx_position_normal GL.RGBA32UI position_normal - global fb-scene-color = (GL.CreateTexture GL.TEXTURE_2D) + global fb-scene-color = (GL.Texture GL.TEXTURE_2D) 'setup fb-scene-color size = (ivec2 2048 2048) format = GL.RGBA32F @@ -705,24 +708,24 @@ let h = 2048 GL.ClearTexImage fb-scene-color 0 GL.RGBA GL.FLOAT null - global rb-scene-depth = (GL.CreateRenderbuffer) + global rb-scene-depth = (GL.Renderbuffer) setup-renderbuffer rb-scene-depth 2048 2048 format = GL.DEPTH_COMPONENT - global fb-scene = (GL.CreateFramebuffer) + global fb-scene = (GL.Framebuffer) setup-framebuffer fb-scene color = fb-scene-color rb-depth = rb-scene-depth - global vao-empty = (GL.CreateVertexArray) + global vao-empty = (GL.VertexArray) - global pg-rasterize = (GL.CreateProgram) + global pg-rasterize = (GL.Program) call attach-shaders (deref pg-rasterize) vertex = rasterize-vert fragment = rasterize-frag #debug = true - global pg-supershader = (GL.CreateProgram) + global pg-supershader = (GL.Program) call attach-shaders (deref pg-supershader) compute = supershader diff --git a/testing/test_subjective.sc b/testing/test_subjective.sc --- a/testing/test_subjective.sc +++ b/testing/test_subjective.sc @@ -74,10 +74,13 @@ ? (z >= 0.0) encN.xy (oct_wrap encN.xy) z +N := 32 + fn persp1 (p) static-if true - r := (p.z * 0.5 + 0.5) - r := (exp2 (8.0 * r)) + r := (p.z * 0.5 + 0.5) * N + r := (1 + 2 * (sqrt pi) / (N * 0.5)) ** r + #r := (1 + 2 * (sqrt pi) / 16.0) ** r #r := 1.0 / r #r := (r / (1.0 - (abs r))) #+ 1.0 #r := (-(log2 (1.0 - r))) @@ -119,7 +122,7 @@ GL.COLOR_BUFFER_BIT GL.DEPTH_BUFFER_BIT GL.STENCIL_BUFFER_BIT - GL.LineWidth 2.0 + GL.LineWidth 8.0 'setup-depth painter 'clear painter @@ -131,7 +134,6 @@ light 0.25 -0.5 1 perspective size transform cpu_shglobals.view - N := 64 d := (vec3 1) / N t := cpu_shglobals.time * 0.1 @@ -169,6 +171,16 @@ hue2rgb (max (unpack (abs pc))) #+ t #color c + local overts = + arrayof vec3 + vec3 p0.x p0.y p0.z + vec3 p0.x p0.y p1.z + vec3 p0.x p1.y p0.z + vec3 p0.x p1.y p1.z + vec3 p1.x p0.y p0.z + vec3 p1.x p0.y p1.z + vec3 p1.x p1.y p0.z + vec3 p1.x p1.y p1.z local verts = arrayof vec3 tf (vec3 p0.x p0.y p0.z) @@ -188,6 +200,7 @@ local p : (array vec3 4) for k in (range 4) q := verts @ (is @ k) + #qv := overts @ (is @ k) p @ k = q d @ k = (map q) let c i = (tetfaces d)