klepto2 Posted September 12 Share Posted September 12 If you open up a material in the editor or try to save it manually via code. The Brightness is not saved. Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted September 12 Share Posted September 12 It's not supposed to be. Brightness is just a hack to make up for the fact that the Win32 color picker only allows colors in the range 0-1. The color is converted to 0-1 color and brightness for display in the editor interface, but it's really stored as a Vec4. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
klepto2 Posted September 12 Author Share Posted September 12 thats what i thought as well, but when you choose another brightness than 100, the colors are safed normalized and after reloading it, the editor shows again 100 instead of the original value. Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted September 12 Share Posted September 12 It depends. If any color channel is less than or equal to 1.0, then the brightness will be reset to 1.0. If any color channel is greater than 1.0, then brightness is used to multiply the values. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted October 11 Share Posted October 11 I tested a little bit, and it was working as expected. Please let me know if you think there is any problem. Here is the code I use for extracting the brightness value, for colors that have one channel value greater than 1.0: Vec4 c = material->GetColor(); c.a = Clamp(c.a, 0.0f, 1.0f); float brightness = 1.0f; if ((c.x > 1.0f) or (c.y > 1.0f) or (c.z > 1.0f)) { for (int n = 0; n < 3; ++n) { brightness = Max(brightness, c[n]); } for (int n = 0; n < 3; ++n) { c[n] /= brightness; } } Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
klepto2 Posted October 12 Author Share Posted October 12 Ok, i don't know why, but it works now. But i would suggest to add the same functionality to the emission color. Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted October 12 Share Posted October 12 Is emission greater than 1.0 really something that will realistically be used? Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Dreikblack Posted October 12 Share Posted October 12 3 minutes ago, Josh said: Is emission greater than 1.0 really something that will realistically be used? Yes, it can be used with bloom effect (for something like lamps, pressed buttons etc.) Quote Link to comment Share on other sites More sharing options...
klepto2 Posted October 15 Author Share Posted October 15 On 10/12/2024 at 3:59 PM, Josh said: Is emission greater than 1.0 really something that will realistically be used? it is more realistically than the brightness > 1.0 of the diffuse channel. In addition to what Dreikblack said, you can use the emission for much more: glowing signs, monitors with text on it and much more. Another benefit of having a brightness value (adjustable from the MaterialClass) is an easy way to implement flickering materials or ways to turn glow on/off. On 10/11/2024 at 8:07 PM, Josh said: I tested a little bit, and it was working as expected. Please let me know if you think there is any problem. Here is the code I use for extracting the brightness value, for colors that have one channel value greater than 1.0: Vec4 c = material->GetColor(); c.a = Clamp(c.a, 0.0f, 1.0f); float brightness = 1.0f; if ((c.x > 1.0f) or (c.y > 1.0f) or (c.z > 1.0f)) { for (int n = 0; n < 3; ++n) { brightness = Max(brightness, c[n]); } for (int n = 0; n < 3; ++n) { c[n] /= brightness; } } This looks right, but it has a major downside (at least in my opinion): Once you set the brightness to 0.0 you lose the color information. In my opinion you should always store the color and brightness independently in the material file. How it is then used in the engine doesn't matter, but it will prevent users from accidentally delete the color information. 1 Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted October 16 Share Posted October 16 Okay I will do it. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.