Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / [SOLVED] what is your take about Text Shadows

Author
Message
haliop787
4
Years of Service
User Offline
Joined: 22nd Mar 2020
Playing: With reality.
Posted: 1st Apr 2020 18:07
I am thinking about adding some shadow to my Text objects...
however i do not want to overload the system with double Text objects , one for the upper with a color and the one behind it acting as fake shadow with blackish color assign to it.

for now i have plenty of texts on screen i really do not want to double it, and i USE TTF fonts so not bitmap fonts are good here..
what is the best solution i am looking at?

should i create a render to image at least for the static Texts ? so they would act as sprites rather than texts? i could save images of the "Static Texts" then it will be simple.
however what about dynamic texts where the Chars could be modified?

any one has a bright solution for this maybe i would most defiantly want to hear.
I just thought of instead of creating double Text objects i could simply draw them twice to screen in the same frame, first the blackish shadow text then the original however then i still get double the draws then i would like...

Didn't see any shadow related commands to Text objects..

The author of this post has marked a post as an answer.

Go to answer

Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 1st Apr 2020 19:04
This post has been marked by the post author as the answer.
Quote: "what is the best solution"

That's easy. Rethink this:
Quote: " i USE TTF fonts so not bitmap fonts are good here"

Especially as one of your options to get it working is this:
Quote: "should i create a render to image at least for the static Texts ? so they would act as sprites rather than texts"

If you do that, then you are essentially creating bitmap fonts in code which is just crazy. Create the bitmap font in a paint program and make it exactly as you like it.
Problem solved.
You're welcome
haliop787
4
Years of Service
User Offline
Joined: 22nd Mar 2020
Playing: With reality.
Posted: 1st Apr 2020 19:48 Edited at: 1st Apr 2020 19:57
Edit : Thank you Scraggle.
the problem i am facing with bitmap fonts (which are the most best solution any where...) is , that i am using the Hebrew Language and it cause too much problems, since look at this:

i am writing here in Hebrew just a random text i find in the web to show the problematic i am facing

וַיְהִי בִּשְׁלֹשִׁים שָׁנָה, בָּרְבִיעִי בַּחֲמִשָּׁה לַחֹדֶשׁ, וַאֲנִי בְתוֹךְ-הַגּוֹלָה, עַל-נְהַר-כְּבָר; נִפְתְּחוּ, הַשָּׁמַיִם, וָאֶרְאֶה, מַרְאוֹת אֱלֹהִים.

so in general it is the same as

ויהי בשלושים שנה, ברביעי בחמישה לחודש, ואני בתוך-הגולה, על-נהר-כבר; נפתחו, השמיים, ואראה, מראות אלוהים.

and there is also


in this picture you can see the first style at the top , the second style and the bottom and in the middle it is RASHI style , also in my apps i am hoping to translate to all kind of languages.
**************EDIT so , the big problem i was thinking before approaching the Static Shadow solution written down here , is if you look the 7 char in the first paragraph of the image ( the big letters) and then go down one line and look at the 11 char (count from the right) then you can clearly see it is the same letter, but in Hebrew every letter may be written in about 7 or 8 i think ways. there for, a constant change of the shadowing is requiring. Static it is then, once a text is on screen, render, black it up, blur it a bit, move it a bit on the X a bit on the Y , and you get the decent shadow.. i guess. still need to check it out.

so at the end rethinking it
yeah bitmap font created inside the app is probably the best.
with that said i just realized how i can manipulate large amounts of text in a second not really creating a bitmap font, just render the entire screen as long as it is static (well rendering only the text Objects, making sure to enable transparency) insert it in a sprite and change its color value, than i can catch like 3 4 5 text objects at once, i am afraid tough that a big sprite covering most of the screen or even the entire screen is bad for performance but i am able to create a low res ImageRender since it is only shadow.
and where it come to buttons, which can move ,rotate, fade in out , i will replace the Text Object with a Sprite .. i really dont want to because of all the changes needed to be made both for Text to Sprite commands and to Tweens, should be simple with Replace and Replace all commands (DAMN I LOVE COMPUTERS)

i would like to add this as a suggestion for a new feature and will make my best building a neat showoff for it.

so something like CreateTextWithShadow(id *which is actually a sprite Id,string,shadowX,shadowY,shadowBlur,shadowColor) // then one just need to remember to act edit it as a Sprite with few more commands for Text inside a sprite. or something.

What about i'll do just that, and maybe you guys (TGC) could improve it a bit tweak it and add it to AppGameKit later on ? i bet you most people will love it.

so i am seeing 2 kinds :
a Dynamic Text with Shadow to Sprite
and a Static Text with shadow to Image Renderer.

Any suggestions will be most welcome, as i go on with it , will post code later on.

Attachments

Login to view attachments
haliop787
4
Years of Service
User Offline
Joined: 22nd Mar 2020
Playing: With reality.
Posted: 1st Apr 2020 21:30
OK now i get it that i have seen it a bit off.
there is no need at all for sprites here.

bitmap fonts should not be created on the fly for this.
i have found a superb answer for this.

so you have 100 texts on the screen. they might change... they might tweek.. etc...
Static yet dynamic Render map with superb ease.

All text are drawn first into the render map, turning a bit black , moving a bit x and a bit y
one sprite to rule them all.. there is even no real need for a shader here although it might be quicker... so eventually you are not rendering each text twice, but just the screen as is with the only the texts,
there might be a problem with Different depths.. but then, rendering twice or more is not a real problem as the app already does this.. so i am guessing , a RenderImage of all the texts of the same depth. chaining their colors adding to a sprite or a quad is probably preferred here and WALLA. fast and reliable.

then you keep playing with the Texts as they are.
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 1st Apr 2020 23:19
Why not simply Render all of the Text to a Render (Color) Image., then the Shader can use the Text as a "Stencil" to then offset and alpha against the main application.
It's not an overly complex thing to do, and would be reasonably "Cost Free" at least on Desktop Graphics Hardware.
That way you're not having to overcomplicate things, it just becomes a Post Process in your Render Queue.
haliop787
4
Years of Service
User Offline
Joined: 22nd Mar 2020
Playing: With reality.
Posted: 2nd Apr 2020 11:54
hmm i do not really understand shaders..
but what i am offering is to Render (color) Image , then just turning it black and moving it a bit on x and y , just rendering the text inside it.
am i Wrong?

Login to post a reply

Server time is: 2024-04-19 09:40:23
Your offset time is: 2024-04-19 09:40:23