Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement LIGHT_SPILL_CUSTOM #312

Closed
airfightergr opened this issue Nov 15, 2017 · 12 comments
Closed

Implement LIGHT_SPILL_CUSTOM #312

airfightergr opened this issue Nov 15, 2017 · 12 comments
Assignees
Labels
priority normal WYSIWYG Lights For the many ~problems~ challenges related to the WYSIWYG Lights
Milestone

Comments

@airfightergr
Copy link

airfightergr commented Nov 15, 2017

To add a LIGHT_SPILL_CUSTOM, I have to use another type of light, Param. Of course that way I will end up with this line in obj file:

LIGHT_PARAM LIGHT_SPILL_CUSTOM .....,

so I have to go to the file and manually remove any LIGHT_PARAM.

If it is possible, please add the LIGHT_SPILL_CUSTOM to the list, with 2 fields, 1 for parameters and 1 for datarefs.

@tngreene tngreene added this to the 3.5 milestone Nov 15, 2017
@tngreene tngreene self-assigned this Nov 15, 2017
@tngreene
Copy link
Contributor

This is indeed a missing feature and is part of the next planned feature. Keep an eye out for future progress!

@tngreene
Copy link
Contributor

See also #313. Pre beta.6 versions should allow you to add a custom property to your light. Try clicking "Add Lamp Property"

For Name put "LIGHT_SPILL_CUSTOM", for Value put everything that should go after it. Don't worry about a reset.

Though a temporary fix, at least this way you won't have to manually remove leading LIGHT_PARAMs

@airfightergr
Copy link
Author

I tried you suggestion with no success. Here is a test case.

test_case_light_spill.zip

@airfightergr
Copy link
Author

Are there any updates on this issue? LIGHT_SPILL_CUSTOM is the one you must use to control the lights via plugin. Currently, using the LIGHT_PARAM you can do it, but you end up with the extra LIGHT_PARAM in the begin, which you have to remove it manually, each time you re-export the object:

LIGHT_PARAM LIGHT_SPILL_CUSTOM 4.07624531 5.903862 -1.00545394 111 111 111 avanti/test/lighttest

The correct output must be:

LIGHT_SPILL_CUSTOM 4.07624531 5.903862 -1.00545394 111 111 111 avanti/test/lighttest

If I use the suggested version above (with the Add Lamp Property) the result is:

VLIGHT 4.07624531 5.903862 -1.00545394 1 1 1
LIGHT_SPILL_CUSTOM 111 111 111 avanti/test/lighttest
LIGHTS 0 1

which of course is not working, since the coordinates are attached to VLIGHT, and of course you get the extra stuff we don't want.

I suggest to add a new entry in the type list (i.e. Custom Spill) and 2 fields, one for the parameters and one for the dataref that controls the light.

@tngreene tngreene changed the title LIGHT_SPILL_CUSTOM Implement LIGHT_SPILL_CUSTOM Oct 3, 2018
@airfightergr
Copy link
Author

airfightergr commented May 24, 2019

I will bump this issue, cause I'm working on a plane and I have a ton of custom spill lights, and every time I export, I have to go through the pain to find and delete each extra stuff (LIGHT_PARAM).

@tngreene
Copy link
Contributor

So, I found a hack to make this work - no find and remove LIGHT_PARAM needed, but, this isn't a great solution.

Make a Object, go into edit mode and delete everything. Add an Object Property.
Name: LIGHT_SPILL_CUSTOM
Value: 111 111 111 avanti/test/lighttest
Reset: (Nothing)

No mesh will be exported (you deleted it), but the property will be written out. The bad part of this is that it would be entirely manual. A really well implemented version of this feature would be like the other lights.

Try it out and tell me if it doesn't meet your needs.

@tngreene
Copy link
Contributor

tngreene commented May 29, 2019

A Proper Implementation

  1. New entry Light Properties > X-Plane > Type enum: "Light Spill Custom"
  2. OBJ8 definition is LIGHT_SPILL_CUSTOM <x> <y> <z> <r> <g> <b> <a> <s> <dx> <dy> <dz> <semi>
    • X, Y, Z can be obtained from the location and bake matrix, like the particle emitter
    • R, G, B can be taken from lamp.color
    • A can be set to 1 and the artist can just choose the color they want. A is dimmer, not real transparency here.
    • S can be taken from lamp.xplane.size, same as LIGHT_CUSTOM, but this time it has a real unit (change xplane_ui.py description based on type). Alternatively, we can force Spot only and use Distance for size (see WYSIWYG lights using Blender's UI for spill, custom, param lights #183 about mappings)
    • DX, DY, DZ can come from the direction of of spot light (light type must be a non-POINT), see Particle Emitter again
    • Semi = cos(deg_to_rad(S) * .5)
    • Dref comes from text field
    • A point light instead of non-Point light makes it an omni light. DX, DY, DZ get set to 1 1 1, Semi = 1. We can use Sphere to visualize this.
  3. Unit Test
  4. Docs

No new properties are needed but, it would be nice to lean towards WYSIWYG lights feature.

@tngreene
Copy link
Contributor

tngreene commented May 30, 2019

This would not be a hard feature, but three things are blocking it:

  1. Making a decision about how deep we want to invest in WYSIWYG lights using Blender's UI for spill, custom, param lights #183 WYSIWYG analogies, because I don't want to make new properties for this then re-use some Blender thing and have to write updater code or tell you to just fix it yourself
  2. Time
  3. Moving to 2.8 is part of WYSIWYG lights using Blender's UI for spill, custom, param lights #183.

@airfightergr
Copy link
Author

So, I found a hack to make this work - no find and remove LIGHT_PARAM needed, but, this isn't a great solution.

Make a Object, go into edit mode and delete everything. Add an Object Property.
Name: LIGHT_SPILL_CUSTOM
Value: 111 111 111 avanti/test/lighttest
Reset: (Nothing)

No mesh will be exported (you deleted it), but the property will be written out. The bad part of this is that it would be entirely manual. A really well implemented version of this feature would be like the other lights.

Try it out and tell me if it doesn't meet your needs.

This works fine. You can do one and the duplicate it any time you need a new one. The only drawback is that since is not a visible mesh, it is very hard to find it again some time later, between 10s or 100s of other objects.

Still though doing a proper preparation / workflow, could make this easy to use:

  1. Name the object properly. Something like light.dome.white, for a white dome light is perfect.
  2. Open in a corner in blender a small window for outliner. Type on the search box light.dome and will be visible on the list, only the dome lights, and you can select the one you want, from there.

@airfightergr
Copy link
Author

A Proper Implementation

  1. New entry Light Properties > X-Plane > Type enum: "Light Spill Custom"

  2. OBJ8 definition is LIGHT_SPILL_CUSTOM <x> <y> <z> <r> <g> <b> <a> <s> <dx> <dy> <dz> <semi>

    • X, Y, Z can be obtained from the location and bake matrix, like the particle emitter
    • R, G, B can be taken from lamp.color
    • A can be set to 1 and the artist can just choose the color they want. A is dimmer, not real transparency here.
    • S can be taken from lamp.xplane.size, same as LIGHT_CUSTOM, but this time it has a real unit (change xplane_ui.py description based on type). Alternatively, we can force Spot only and use Distance for size (see WYSIWYG lights using Blender's UI for spill, custom, param lights #183 about mappings)
    • DX, DY, DZ can come from the direction of of spot light (light type must be a non-POINT), see Particle Emitter again
    • Semi = cos(deg_to_rad(S) * .5)
    • Dref will come from us. No dataref means better performance
    • A point light instead of non-Point light makes it an omni light. DX, DY, DZ get set to 1 1 1, Semi = 1. We can use Sphere to visualize this.
  3. Unit Test

  4. Docs

No new properties are needed but, it would be nice to lean towards WYSIWYG lights feature.

If I'm not wrong, this particular type of light is to be controlled only with the use of plugins. For that reason, the only thing that happens with the object is to initialize the 9 values of the array (dataref).
All values will be set/controlled by the code. So just 9 "1s" or "0s" work fine.

The only WYSIWYG future I would like to have, as a coder, is the DX, DY, DZ values, since it is a bit cumbersome to calculate them.

@tngreene
Copy link
Contributor

tngreene commented May 30, 2019

If I'm not wrong, this particular type of light is to be controlled only with the use of plugins. For that reason, the only thing that happens with the object is to initialize the 9 values of the array (dataref).
All values will be set/controlled by the code. So just 9 "1s" or "0s" work fine.

The only WYSIWYG future I would like to have, as a coder, is the DX, DY, DZ values, since it is a bit cumbersome to calculate them.

If the Dataref value is removed, then there is no plugin to control it. For those cases we'll want to take the other parts from the Blender UI.

Also: Glad the hack works! Check in with the progress of #428 later on so you can have the Empty's axis displaying where it is, which, I think is much nicer.

@airfightergr
Copy link
Author

This works fine. You can do one and the duplicate it any time you need a new one. The only drawback is that since is not a visible mesh, it is very hard to find it again some time later, between 10s or 100s of other objects.

I misjudge this one...my bad. Actually is NOT working. Exports OK with all the data I add, but does not export the coordinates.

So back to adding light and delete the LIGHT_PARAM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority normal WYSIWYG Lights For the many ~problems~ challenges related to the WYSIWYG Lights
Projects
None yet
Development

No branches or pull requests

2 participants