pouët.net

How to render SDF grid volumes?

category: code [glöplog]
 
I'm new to this board and hope help-type questions are allowed.

I've created a ray marching demo in JS using canvas 2D. It works fine when I used Signed Distance Functions. When I try to use SDFGen to convert my OBJ to a grid-based SDF file I cannot render it correctly. I'm new to graphics programming and so it's probably something basic that I'm doing wrong.

My approach is to use trilinear interpolation for resampling. I have no idea if that's correct.

https://gist.github.com/rostero1/2bd57a059c4f711bec801cf6e6c4606e#file-index-js-L48-L53

model.js contains the contents of the SDFGen generated file. I had to truncate it for gist, but here's the full version: https://gist.githubusercontent.com/rostero1/2bd57a059c4f711bec801cf6e6c4606e/raw/17cf3241da8960fc23d39730238064763d8037f7/model.js
added on the 2018-03-24 14:56:37 by rostero rostero

login