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
Gui: fixes issue #11113: Adjust Default Main Light Position #11146
Conversation
Can someone make a clip demonstrating this feature please? 🙏 |
I'm not an expert in 3D modeling, but it would be better if there were a few light sources. |
CC @howetuft (think you would be interested in this feature) |
I don't think Coin3D is capable of what Blender can do. I have tested what happens when there are more light sources. When they emit their lights from the sides then your model has almost no dark areas any more but it also increases the risk that it looks completely white. For now this PR solves the reported issue but it might be an option for the future to extend the lighting. |
Most 3D CAD programs like Solidworks use HDR maps just like easy reflect macro does. https://forum.freecad.org/viewtopic.php?t=80916&sid=4ce1afafcd81f8607c8cbb504128af98 |
I think that this is a clear improvement, so even if there are even more ways of improving, I'm inclined to merge this as-is. |
Thanks, I will test it when it is in the weekly builds as I cannot build it myself.
|
The lighting is done by SoDirectionalLight that has a SoSFVec3f field. I don't think this direction depends on the camera view direction. The default light direction is (0,0,-1). As it's independent of the camera view direction it's only parallel if the camera looks down/up the Z axis. |
Then this is not what renders all glossy materials white. If you look at the example of #11113 from the bottom view (or normal to any face) they will render white. I just coincidentally modeled the demo file so that it appears white from the top (could be from any direction) Or is (0,0,-1) in reference to the camera view (as Z is always normal to sketches in their coordinates)? Then this would be fixed with the new setting when changing the default. |
That's why we have the preferences page where you can change the light direction to something different to (0,0,-1). If you then look from top on the model it doesn't look white any more. Another option is to reduce the intensity from 100% to e.g. 60%. |
If needed we can change the default. |
great, I would propose (1, -1, -1) - is this feasible? |
QColor color = ui->light1Color->color();
double red = color.redF();
double green = color.greenF();
double blue = color.blueF();
view->getHeadlight()->color = SbColor(float(red), float(green), float(blue)); Is there a reason behind that? |
This doesn't look good. I would try (0.2, -0.2, -1). As already said you can test this setting with your version. Open the parameter editor and go to BaseApp/Preferences/View. If the key HeadlightDirection doesn't exist then create it as a text object and set its value to |
With Qt5 It returns a qreal which is an alias for double. But with Qt6 it indeed returns a float now. |
This looks good! |
Why is Why do the developers deliberately avoid standard usage of Qt Signals & Slots mechanism, for example, in case of setPaneText of MainWindow? @wwmayer, this pull request seems to avoid its standard usage too. Here, you connect the checkbox connect(ui->checkBoxLight1, &QCheckBox::toggled,
this, &DlgSettingsLightSources::toggleLight); with the function void DlgSettingsLightSources::toggleLight(bool on)
{
view->getHeadlight()->on = on;
} while the headlight already has the method toggling light. FreeCAD/src/Gui/Quarter/QuarterWidget.cpp Lines 395 to 398 in b70956b
Sorry to bombard you with questions, but I hope you will shed headlight when you find time. |
In how far? The property mechanism allows it to set or get a property by string with But I don't see how this would fit here because the dialog must react on signals emitted by its child widgets.
What is the standard usage of Qt Signals & Slots? Do you mean to write a slot function of the form And the old-style connection using the SIGNAL/SLOT macros is not recommended either. In both cases you only may get a warning at runtime and this is tedious to test. And once you made sure it works correctly you can never be sure that it breaks all the sudden in the future. The recommended and safest way is to use the new style connect with function pointers because there the compiler already tells you if a connect fails. Of course, it's a lot more work but that's the price you have to pay.
What exactly is your complaint about setPaneText?
Ah thanks. I will prepare a PR to fix this and the color issue. |
I should have provided more details about I have made the commit xtemp09/FreeCAD@e2c342b to use the Qt messaging system to deliver the dimensions from View3DInventorViewer to the sizeLabel. I thought it would be better if the widget uses thisFreeCAD/src/Gui/ProgressBar.cpp Lines 312 to 342 in aaa9629
|
I think such things should be discussed elsewhere as it has nothing to do with this PR.
Isn't this a direct connection, rather than a queued connection?
It could be checked as alternative. |
@wwmayer Thinking about your implementation of the light setting: would it be easy to implement the option in the preferences to add multiple lights, adjust them each and also remove lights again? |
This could be done in future PR |
Done: #11166 |
@wwmayer when I set the HeadlightDirection in the Parameters Editor directly, it is instantly changed in the 3D view. When I then open the preferences and just klick apply, another value is set. |
The light dragger node returns a rotation but the directional light node only needs a vector. Now when opening the preferences the rotation must be restored but from the stored vector alone this is not possible because it's ambiguous. That's why the values of the rotation are additionally saved as quaternion. If you directly modify the direction vector in the editor it will be overridden by the values that are derived from the rotation the next time you open and save the preferences dialog. |
No description provided.