Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Importing OBJ with very large coordinate values
#2
SharpEngine is using float on the CPU and on the GPU in the shaders. As you have found out, when using big numbers, this can lead to some floating point precision problems. This can be solved by somehow normalizing the data - this can be done by centering around (0, 0, 0) as you have done.

To prevent losing precision, it would be best to read the obj data as double and immediately transform that to center around (0, 0, 0) and then store that adjusted value as a float value.

I will send you the source code of the ReaderObj to your email so you will be able to adjust the code. But if all your obj files have the same structure, you can simpfly the ReaderObj and create your own parser.


The current version of SharpEngine does not support disabling culling (or using custom RasterizationState). For now, you will need to set the BackMaterial to the same material as set to the Material property - this will render both the front and the back side of each triangle.
Andrej Benedik
  


Messages In This Thread
RE: Importing OBJ with very large coordinate values - by abenedik - 01-08-2024, 10:22 AM

Forum Jump:


Users browsing this thread:
1 Guest(s)