WIP displacement map feature.
 
Notifications
Clear all

WIP displacement map feature.  

  RSS
Poikilos
(@poikilos)
New Member
WIP displacement map feature.

Displacement maps can save a huge amount of storage and bandwidth for all parties. Storing and editing dozens of models with more than one polygon per pixel is a pain.

The the feature request is at: https://github.com/prusa3d/PrusaSlicer/issues/8649

I made some progress!

 

Known issues:

- Multithreading gets a bit weird, so loading the image before splitting into threads would be ideal. For now I've implemented sleep calls and manual locking (via a this->busy boolean) to avoid problems. I'm sure there is a better way to do this but I'm not very versed in this topic.

- Loading different bit depths other than greyscale requires some "if" cases. I say it that way to avoid changing from auto to pointer and adding "new" statements, for predictability. However, if you have a better way of making it stable.

- Mapping isn't really implemented. The alignment only works on objects with a straight profile (from every view on a turntable), with seam set to "Aligned". The issue is visible on the following object with uneven profile (It starts out ok on the seam then gets misaligned):

The mapping will have to be done by any of the following:

A. Improve or better utilize the STL loader to include UVs

B. Perform cubic mapping by projecting the curve onto a flat view.

I'll be looking into B but feel free to fork my displacement_map branch and I can help merge if you improve things in a direction that works for me: https://github.com/Poikilos/PrusaSlicer/tree/displacement_map

Coming up with a simple implementation (after trying and giving up on doing this at a shallower place in the callstack) has been exhausting so after I complete B above to at least make it suitable for my purposes, I'll probably take a break and see if anyone will show any interest and help provide code.

Therefore, if you know how I could have done it better, please add your own PR to improve my branch.

Napsal : 24/12/2022 11:26 pm
3Delight se líbí
Poikilos
(@poikilos)
New Member
Topic starter answered:
RE: WIP displacement map feature.

- (done) Implemented cube mapping! It calculates the normals on the X-Y plane.

Napsal : 28/12/2022 3:16 am
Share: