Little Addon for optical lenses etc.

General project and community related discussions and offtopic threads.
CodeHD
Posts: 301
Joined: Tue Dec 11, 2018 12:38 pm
Location: Germany

Re: Little Addon for optical lenses etc.

Post by CodeHD » Sun Apr 05, 2020 8:49 pm

uuh sweet, I must have overlooked that :D

wasd
Posts: 314
Joined: Tue Apr 24, 2018 7:20 pm

Re: Little Addon for optical lenses etc.

Post by wasd » Mon Apr 06, 2020 4:22 am

I think using words "floating point" and "precision" in one sentence should be strictly forbidden. Also, with 64 bit we won't even need the point to float.
CPU Bidir (sometimes GPU Path) + Metropolis | Log Power | Core i5-4570

CodeHD
Posts: 301
Joined: Tue Dec 11, 2018 12:38 pm
Location: Germany

Re: Little Addon for optical lenses etc.

Post by CodeHD » Tue Apr 07, 2020 8:27 pm

I did a quick test, and enabled the option for both custom split normals as well as autosmooth on a regular mesh. It is controlled by a second switch. The autosmooth version is enabled by default because v2.3 is the latest stable release.
new_menu.png
new_menu.png (4.71 KiB) Viewed 300 times
I've also tested the difference on the rendering result. Using custom split normals does change the result a bit for the better. However, no change to the shift-issue. See the following comparsion with a single lens at the origin. First old mesh with autosmooth, second with split normals.
autosmooth.png
customsplit.png
Then I also tested the influence of absolute size. Indeed, it seems that the "realistic" scaling leads to additional errors. A lens works better if it is a few m large. I find this strange, float should provide enough orders of magnitude to acommodate for everything, and it says everywhere I read that Blender internally uses float, just the display is rounded to 5 digits. Any ideas?

BYOB, where did you actually get the info that cutsom splits have higher precision that regular normals? I found no docs that specify this.

User avatar
B.Y.O.B.
Developer
Posts: 3555
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: Little Addon for optical lenses etc.

Post by B.Y.O.B. » Tue Apr 07, 2020 8:35 pm

When I implemented the custom normal support, I wasn't satisfied with a Python solution (because slow), so I dug around in the Blender source code until I could extract a raw pointer to the custom normals array. And that is a float array.

You can see here that the regular normals are shorts (2-byte integer): https://github.com/LuxCoreRender/LuxCor ... ypes.h#L64
And here the custom normals are extracted (4-byte float): https://github.com/LuxCoreRender/LuxCor ... r.cpp#L679

Fox
Posts: 421
Joined: Sat Mar 31, 2018 11:17 am

Re: Little Addon for optical lenses etc.

Post by Fox » Tue Apr 07, 2020 9:06 pm

Blender precision is just horrible.
Here i only have small cut-off of earth real size, but i need real origin for procedural shader.
Blender precision.jpg

CodeHD
Posts: 301
Joined: Tue Dec 11, 2018 12:38 pm
Location: Germany

Re: Little Addon for optical lenses etc.

Post by CodeHD » Tue Apr 07, 2020 9:14 pm

We can put that on the pro-list for a "Lux Studio" :D

Post Reply