adrian.licuriceanu Posted May 18, 2016 Share Posted May 18, 2016 Hello, I've activated bloom effect (render_bloom on 1) but doesn't seem to have any effect. So my questions are: - How do I control bloom parameters like the amount of brightness, what pixels are more bright than others etc? Is this related to HDR output? I mean can I just output pixels diffuse above 1.0 in the shaders and this will glow more than others? - Is there a way to control these parameters from Unigine script? I want for example, when the night comes to have certain areas (lit windows) to appear very bright (like emitting light). Kind Regards, Adrian VStep Developer Link to comment
silent Posted May 19, 2016 Share Posted May 19, 2016 Hi Adrian, The only setting that available for Bloom tuning is Camera Effects Threshold. It is located inside Rendering Settings -> Camera -> Threshold. You also can change this setting via engine.render.setCameraEffectsThreshold() method. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
adrian.licuriceanu Posted May 19, 2016 Author Share Posted May 19, 2016 Hi, And thank you for the fast response. So basically if the value of the pixel in the final HDR buffer is above this constant the bloom blurring is applied? Seems to be this way, if I set it for example to 0.7, everything above 0.7 is blurred and glows. This is basically what I need but, I want to use a bigger value, above 1.0 for it (so only certain pixels are blurred). Setting for example this value to 1.0 only brightly lit areas (specular hightlights) are blurred. But I want to set this even more, at, for example, 3, so during the night, only the lit windows are bright while during the day nothing is affected (not even the brightly lit areas from the sun). Now, in my night time lit windows custom shader that fill the deferred buffers, for the pixels corresponding to windows I set the deferred lightmap buffer to a value above 0. This from what I figured out, tells the engine to considered these pixels as static lit and they are not affected by dynamic lighting in the deferred composite pass (what I want). But how to I get them to have a final buffer value above 3.0 so they are also affected by bloom and glow? I've tried setting up the diffuse to RGB values above 3.0 but I believe they are clamped to 1.0. I've tried setting the lightmap or the specular but the results are the same. How do I mark some pixels that are not to be affected by engine deferred lighting (statically lightmapped) to glow via bloom? Regards, Adrian Link to comment
adrian.licuriceanu Posted May 24, 2016 Author Share Posted May 24, 2016 Hello, Nobody? I saw that the final composite fragment shader (where the deferred buffers are combined) is composite_deferred.frag. Is this the final fragment used in case of opaque deferred shading? If so, can't I just put values over 1.0 in the lightmap buffer (since it is 16bit float) for the lit windows area? And the following code (from the composite_deferred.frag): ... color_in = TEXTURE_BIAS_ZERO(TEX_LIGHT_MAP,uv); float3 light_map = color_in.rgb; ... #elif USE_SURFACE_LIGHT_MAP diffuse_out += light_map * occlusion; #endif ... should just create a final output bigger than 1.0 for those pixels making them glow. From looking at the shaders it seems that way, but it doesn't work. Which suggest to me that I am either assuming wrongly that this is the final shader or the lightmap is somewhere clamped to 1. Any help is greatly appreciated as I am king of stuck. Regards, Adrian Link to comment
silent Posted May 25, 2016 Share Posted May 25, 2016 Hi Adrian, Is there any chance to take a look at the small scene with your custom shader to get an idea what is going on? composite_deferred.frag is indeed the final fragment shader and currently we have no idea what can cause the lightmap buffer ignore values more than 1.0. Small test sample can help us find the root cause of this issue much faster. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
adrian.licuriceanu Posted May 27, 2016 Author Share Posted May 27, 2016 Hi, I will have to talk with the management about sharing some of our code. I don't know all the confidentiality details so I can prepare a smaller scene that doesn't contain some of our confidential code. I will get back soon with an answer. Thank you! Adrian Link to comment
adrian.licuriceanu Posted June 6, 2016 Author Share Posted June 6, 2016 Hi again, I've done an additional test to see why lightmap may be clamped to 1.0. I've modified the default Unigine fragment shader for meshes (core/shaders/mesh/fragment/deferred.frag): after: SET_LIGHT_MAP(lightmap) right at the end I've added: #ifdef USE_DECALS output.color_6 = float4(5, 5, 5, 1); #else output.color_5 = float4(5, 5, 5, 1); #endif So the lightmap MRT is modified with some hardcoded value (5,5,5,1) over 1.0. The world script contains the following settings: <camera_effects_threshold>1.5</camera_effects_threshold> <render_bloom>1</render_bloom> <render_ssao>0</render_ssao> <render_surface_ao>0</render_surface_ao> <render_surface_light_map>1</render_surface_light_map> So the lightmap is being used in the deferred pass. It seems that any value above 1.0 creates the same results (white texture without any bloom no matter the camera_effects_threshold. So even for the standard materials lightmap values over 1.0 are somehow ignore (don't make any difference) from bloom point of view. So either somewhere they are clamped or the deferred shading is applying in a different way than I though. Please advice! I believe now you have all the info to verify this on your end since it can be easily reproduced on default Unigine with the steps above. Adrian Link to comment
grmmvv Posted June 8, 2016 Share Posted June 8, 2016 Hi,Lightmap values in engine are not clamped, you can check this by modifying lightmap values from fragment shader: * open core/shaders/mesh/fragment/deferred.frag; * near EOF, modify string "SET_LIGHT_MAP(lightmap)" to "SET_LIGHT_MAP(float3_one * 1000)"; * after that run engine and decrease "Camera Effects: Exposure" to 0.02 for example, you'll see that the lightmap can apply values more then one.This issue (white texture without bloom effect) happens because of tone-mapping effect which applies before the bloom effect. Tone-mapping removes too bright areas, that's why high values in lightmap look clamped.If you want to get image without tone-mapping correction, disable it by console command "render_filmic 0". Link to comment
adrian.licuriceanu Posted July 17, 2016 Author Share Posted July 17, 2016 Using render_filmic 0 still doesn't make any difference from bloom point of view, even if I modify the deferred.frag as described above. With filmic on, I don't have bloom where specular effect is big (from the normal lighting, not from lightmap). With filmic off there is some bloom where the light specular is present. But using values above 1 for lightmap doesn't make any difference. Any idea why? Any idea how to obtain a big bloom effect for these pixels? Using lightmap values or other method. Maybe doing another pass for emission? Link to comment
grmmvv Posted July 21, 2016 Share Posted July 21, 2016 Hi,Unfortunately, we can't reproduce your issue. We can create bloom effect both from lightmap and lights, please see attached pictures.To achieve same result as at the first picture, do the following: * create new project; * open this project in editor; * turn off the sun node; * open "Materials window" and select "material_ball" material; * go to the "States" tab and change "Light map" option from "Disabled" to "Without environment"; * next to the "Parameters" tab, in the "Lightmap" section change "Intensity" from 1 to 10, for example; * after that go to the Rendering => Camera effects; * make sure that "Bloom" option is enabled (or set render_bloom 1 in console; * uncheck "Filmic tone mapping" option (or set render_filmic 0).Note that you can't create bloom effect from lightmap with enabled filmic tone mapping, there is known issue, fix will be available with the next SDK release.Could you give us some additional content, that may help us to undestood and solve you problem: * simple test scene with non-working bloom effect; * some screenshots that shows your issue. Link to comment
adrian.licuriceanu Posted July 23, 2016 Author Share Posted July 23, 2016 Hello and thank you for the support. I was able to finally obtain bloom using the lightmap output values. It seems that for a camera_effects_threshold of 2.5 I had to output lightmap values above 10 for the bloom to be visible. Also when seen from distance and the windows are small, bloom is not applied at all (even though windows are still visible as white areas). When I get close bloom becomes really bright and large. I would want a more discrete bloom that it is still visible from distance (the reverse of the current behavior). But now that it is at least working I will look over the bloom shader to see if I can improve the results. Link to comment
Recommended Posts