leozide / leocad

A CAD application for creating virtual LEGO models
https://www.leocad.org
2.46k stars 208 forks source link

Blender Lights Export Review #914

Open trevorsandy opened 6 months ago

trevorsandy commented 6 months ago

Hi Leo,

I've reviewed the Blender and POV-Ray lights behaviour up to commit b6de368 in order to implement the changes in blenderldrawrender. There are some outstanding items I'd like to clarify and close before I commence with the updates.

For reference here are the Blender light and light object transform defaults: Blender_Light_Defaults_01

Blender_Light_Transform_Defaults_01

Here are my findings:

It would be enough to simply add your response (will/won't change etc...) below the respective bullet item.

Cheers,

leozide commented 6 months ago

Hi Trevor,

I wanted to have a single light for both Blender and POV-Ray, and people can configure the app specific settings if they want to. I think this works better because in general people would place the same light for both apps and tune app-specific parameters if needed but I'm happy to discuss.

  • [ ] General

    • [ ] POWER default value changed from 10 to 1 - Consider using Blender default 1000

Default power for me in Blender is 10

  • [ ] ATTENUATION_DISTANCE and ATTENUATION_POWER not expected by Blender

These are POV-Ray only (fade_distance and fade_power).

  • [ ] Change transform ROTATION format from XYZ vectors to XYZ Euler angles

This is a rotation matrix, not vectors. You can convert it to euler angles like we do on the UI, but I'd rather save it as a matrix.

  • [ ] When moved, ROTATION values in Properties do not match values in bottom-right UI message bar We don't display the rotation on the status bar, what do you mean?

  • [ ] No UI to distinguish between POV-Ray and Blender lights. For Blender lights:

See first paragraph.

* [ ]  Exported `POWER` default is _1_ but Blender `POWER` default is _1000_

Default power for me in Blender is 10

* [ ]  Pointlight `RADIUS` not exported, `SIZE` not expected
* [ ]  Spotlight `RADIUS` exported as first value of `SIZE` pair - e.g. `SIZE .2 0`

Size is radius, I can change the exported key for clarity.

* [ ]  Directional light `ANGLE` not exported, `SIZE` not expected

Size is angle, I can change the exported key for clarity.

* [ ]  Arealight `AREA_GRID` not expected

This is POV-Ray only

  • [ ] Pointlight

    • [ ] RADIUS not exported
    • [ ] RADIUS default changed from .25 to 0 - Consider using Blender default .1

Default radius in Blender is 0 for me

  • [ ] SIZE not expected by Blender See above.
  • [ ] Spotlight
    • [ ] SPOT_BLEND missing

SPOT_BLEND = SPOT_PENUMBRA_ANGLE / SPOT_CONE_ANGLE, I followed POV-Ray here because I thought it made more sense at the time, let me think about this one.

  • [ ] RADIUS exported as first value of SIZE pair - Consider exporting as RADIUS n
  • [ ] RADIUS (SIZE) default changed from .25 to 0 - Consider using Blender default .1

Default size in Blender is 0 for me

  • [ ] Cannot enter more than 1 decimal place for RADIUS (SIZE) property

I'll take a look.

  • [ ] Directional (Sun) Light
    • [ ] SIZE not expected by Blender
    • [ ] ANGLE not exported

See above.

  • [ ] ANGLE default changed from 11.4 to 0.0002

Default angle in blender for me is 0.526

  • [ ] Arealight
    • [ ] AREA_GRID not expected by Blender

See above.

I don't know why my defaults are different from yours (I have Blender 4.0), I don't mind changing them once we figure out what they should be.

I'll rename some of the keys for clarity.

trevorsandy commented 6 months ago

I wanted to have a single light for both Blender and POV-Ray, and people can configure the app specific settings if they want to. I think this works better because in general people would place the same light for both apps and tune app-specific parameters if needed but I'm happy to discuss.

Indeed, and I agree. However, taking into account the different input parameter between POV-Ray and Blender, I felt it was necessary to distinguish between the two applications. To this end, I imagine one could consult the Parameter UI (as I did in the initial PR) or generate the appropriate indicator depending on the selected Render menu item selected. Nevertheless, I'll conclude that there won't be any behaviour to distinguish between POV-Ray and Blender.

Default power for me in Blender is 10.

Currently 10 is also the default I expect from the input file in blenderldrawrender. So if you revert to using 10, I would not have to make any changes.

These are POV-Ray only (fade_distance and fade_power).

Indeed. With no way to distinguish between POV-Ray and Blender, I imagine you are flushing parameters for both on save/export.

SPOT_BLEND = SPOT_PENUMBRA_ANGLE / SPOT_CONE_ANGLE, I followed POV-Ray here because I thought it made more sense at the time, let me think about this one.

Very well. So as the default SPOT_PENUMBRA_ANGLE value is 0 the default SPOT_BLEND will calculate to 0 also.

This is a rotation matrix, not vectors. You can convert it to euler angles like we do on the UI, but I'd rather save it as a matrix.

Very well.

I don't know why my defaults are different from yours (I have Blender 4.0), I don't mind changing them once we figure out what they should be.

I'm using Blender 3.4.1, but I installed 4.1.0 and also got the same defaults. Perhaps these defaults depend on screen-size but I could not find any definitive information about this.

When moved, ROTATION values in Properties do not match values in bottom-right UI message bar

We don't display the rotation on the status bar, what do you mean?

When I move the Spotlight ROTATION handle, both the Properties and Status Bar values are updated; however, these values do not match. The same behaviour is exhibited when I move the POSITION handle and the values match.

Blender_Light_Rotation_Status_01

Cheers,

leozide commented 5 months ago

FYI, here are the defaults from the Blender source: https://github.com/blender/blender/blob/2548132e23f55a4891f428a4f01e5b33023e6f63/source/blender/makesdna/DNA_light_defaults.h