maxime.isnel Posted May 12 Posted May 12 Hello, I am using ObjectText to display text on signs on Unigine 2.18.0.1. I would like to replicate the sign on the right with the ObjectText. The text that have to display is : Z50- 1' 2 All should be centered (like the right sign) but when I use the align=center it does not like the end of line and does not center the text. How can I fix this ? I have tried many thing with end of line character, spacing, ... Note : I use "<b> </b>" to force to display the last line. Thank's Maxime
silent Posted May 12 Posted May 12 Hi Maxime, I'm afraid, ObjectText currently does not support all the rich formatting options. The only viable option that you can try to do in 2.18.x is to split this text to 3 different ObjectText objects and align them manually. Thank you! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
maxime.isnel Posted May 12 Author Posted May 12 (edited) Thank you. I will do this. Is it something implemented in newer version ? (2.19, 2.20 or 2.21) Edited May 12 by maxime.isnel
silent Posted May 12 Posted May 12 Not yet, but I will raise the priority of this feature in our internal bug tracker. At this point, I can't provide an estimate for when it might be implemented, as demand for this feature has not been very high so far. ObjectText is typically used more for utility and debugging purposes rather than as a drop-in replacement for text in textures. It is also less readable at longer distances compared to textures, due to architectural limitations and performance considerations. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
maxime.isnel Posted May 20 Author Posted May 20 One more question about ObjectText, by default they don't take account of the light. So when there is no light they are display like they are emissive (see screen). Is there a way to make them affected by light ? At least they don't show up like this at night ? Thank you !
silent Posted May 20 Posted May 20 Hi Maxime, That is not currently possible, since ObjectText is designed to be completely unlit (it is rendered in the GUI pass). As a workaround, you can try adjusting the text color via API and make it darker depending on the time of day. For example, during evening or night scenes you could switch the color to black. However, the text will still remain unlit, meaning that even if you point a flashlight at the sign, the text will not become illuminated or turn white again. Or you can do very hacky things and automatically lerp text color using the sun height. For that you need to edit <PROJECT>/data/core/materials/base/objects/gui/text/shaders/ambient.frag and add dimming function: // dim with sun height: dot(sun_dir, up) is +1 at noon, -1 at midnight float day_factor = smoothstep(-0.1f, 0.25f, dot(s_scattering_sun_dir, s_sky_up)); float dim = lerp(0.05f, 1.0f, day_factor); OUT_COLOR.rgb *= dim; sun_text.mp4 Full shader you can find in the attachment. Also this will work only with WorldLight, not with Omni / Proj light sources. Also it can look quite unrealistic at the evening and produce too dark text. Maybe you can figure out the better dimming algorithm, not a simple lerp. Thanks! ambient.frag How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
Recommended Posts