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 / Using text in VR

Author
Message
Grumpydlw
10
Years of Service
User Offline
Joined: 2nd Nov 2013
Location: Las Vegas, Nevada
Posted: 25th Aug 2022 19:57
Is it possible to display text in VR?
I have a couple thousand lines of text (descriptions) that I would like to be able to see while using VR.
I only need a dozen at a time But creating .png images of all of them and then placing them into an array is ridiculous.
I have them in a text file and access the text file BUT how do I display them on the VR screen?

I would also like to see an AppGameKit Studio VR Community group started.
VR has special cases that don't work when searching through the AppGameKit and AppGameKit Studio Chat rooms.
SFSW
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 25th Aug 2022 21:58
The best way (both functionally and aesthetically) is to render the text you need to a RenderImage using the text commands, then apply that render image to a surface (ie plane object). That way, it appears in your scene in full 3D as part of the VR environment and can move with the players head or be stationary (as though rendered on a screen).
Grumpydlw
10
Years of Service
User Offline
Joined: 2nd Nov 2013
Location: Las Vegas, Nevada
Posted: 26th Aug 2022 04:17
Thank You But that still didn't help me get the text to the image.
I may be missing something. I don't see how my text gets input into the image.

Hopefully this explanation will help.

I have 12,000 3D models.
I have them separated into Folders by Category.
In each Folder is a "Sub Folder" which contains a further breakdown in the form of a text file.
I access the text file and some of the information is the mesh and texture locations.

The text file has up to 50 model descriptions.
each description is 10 lines of text.
examples would be model mesh location and name, primary texture location and name, alternate Textures and location, Sounds associated, animations,

When I view a model and "select it" I would like the associated 10 lines of text to be displayed on a "viewing screen" in the VR world.
That's 120,000 lines of text available in asci format I need to access.

I hope this explains why rendering each line to an image is totally impractical.

SFSW
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 26th Aug 2022 05:16
Have you worked with render images before? It's no different than rendering each line to the screen. The only difference is you are capturing the text to an image buffer instead of the screen buffer, which gives you more options with it in 3D/VR. You just render the '10 lines of text' you need to the render image, which is linked to the surface you want to place in your VR scene. And you don't even have to leave 10 text indexes active, just one render image index is all that's needed for as many text lines as you need to fit.

What you can do is just create them on demand. Break down your 120,000 line master file into something more modular and manageable (if it isn't already), then load the needed data when needed (reading line-by-line) and apply the 10 lines at a time to a render image.
SFSW
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 26th Aug 2022 05:35
Here is a function I put together you can use to try it. It's very flexible and you can save the render to a file to see what gets applied. Rem lines provide some guidance. The text size factor can vary greatly, so you may need to tune that value to whatever your screen/display and font parameters are set to.



Once the RenderImage is created, you can apply it to a surface like any other texture in your VR scene.
Grumpydlw
10
Years of Service
User Offline
Joined: 2nd Nov 2013
Location: Las Vegas, Nevada
Posted: 26th Aug 2022 06:46
Thank You.
I'll give this a shot tomorrow. It's late here.
I think I understand and what I was missing is that this all takes place on the monitor and not in VR
The final product happens in VR.

I'll be back tomorrow Thank You.
JosephB
17
Years of Service
User Offline
Joined: 12th Sep 2006
Location:
Posted: 26th Aug 2022 22:52
If you include @SFSW's function in your code, you need one more line of code to return the render to the screen ( SetRenderToScreen() ) to see the results. I have added that code to the end of @SFSW's function as follows:




SFSW
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 26th Aug 2022 23:12
Ah yes, good point JosephB, thanks! I'm frequently toggling between render images and the screen in my main loop code, so I don't usually put that into functions. It's an important step to include for general use though.
Grumpydlw
10
Years of Service
User Offline
Joined: 2nd Nov 2013
Location: Las Vegas, Nevada
Posted: 27th Aug 2022 00:48
I don't get that far.
I've set it up as a GoSub instead of a function since I'm more familiar with calling Subs. and I'm not passing arguments.
Unfortunately I'm crashing back to the AppGameKit screen when calling SetRenderToImage.

Am I still missing something?
If it's the "function" call how do I call a function?
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 27th Aug 2022 01:18 Edited at: 27th Aug 2022 01:50
i'm not really following this thread as i don't use VR but perhaps consider Functions (long name: "User Defined Functions") as "custom" commands or a group of commands that may or may not accept parameters (same as standard commands), and may or may not return a value. see HERE for a bit more on Functions.

from that, reminder: variables declared within a function are considered LOCAL meaning everything about them "lives" within the Function/EndFunction tags unless declared GLOBAL (within or outside of the function). see variable Scope.

ie, Local variables are created within the function and deleted upon exiting the function.

i shied away from functions and stuck with SubRoutines for the longest until i discovered the power of functions under the previous "definition". It can be more efficient and flexible and optimal for code recycling.

see this Useful Community Functions thread for a number of handy functions that are pretty much "drop into your own code" simple.
Grumpydlw
10
Years of Service
User Offline
Joined: 2nd Nov 2013
Location: Las Vegas, Nevada
Posted: 27th Aug 2022 02:31
I will research and study functions to further my knowledge base.
I appreciate the links to info.

I believe I should still be able to have this work as a subroutine.
However it crashes back to the AppGameKit editor. exiting my VR program.
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 29th Aug 2022 11:51
Both Print and Text will work in VR the exact same way they do in Standard Rendering.
The problem you'll come across is that potentially said Text is going to be unreadable.

But why is this? I mean if we change the resolution, it remains the same percentage size on-screen., which is due to AppGameKit Auto-Scaling Text and Sprites against the initial resolution.
While I'm not against this behaviour... but how AppGameKit handles this is somewhat, problematic and confusing.

Why is it a problem?
I mean we want things like Text to remain roughly the same size on the screen at different resolutions... right?
Well, no... we don't.

If we take VR as a good example here... there is a minimal size text can be in the view, because of lensing effect.
The VR Screens (for each eye) are usually Flat., this is because a Curved Screen has gaps that at a High Enough Resolution and Screen Size (meaning you're viewing it further away) is fine; because you don't notice but at a few inches from your face... yeah it's VERY noticable.
As such to produce the necessary curvature; lenses are used to curve the output image.
The problem is that this means you end up with a somewhat similar effect to Interlaced Images., that being the Odd and Even Fields don't match up and thus result in Text being Blurry and difficult to read.

So, for Text we have to take a similar approach we used to have to use on the old 8bit and 16bit Consoles... where you just didn't have the Resolution and were outputting to an Interlaced Display.
There are two solutions... use a Font with better Interlaced Readability (i.e. take away every other pixel line from the Font... is it still readable? if no, it isn't going to work... if yes... then it's good) and/or increase the size; which means designing around a larger area UI.
I mean what also helps is removing background elements.

Like there is a reason A LOT of NES and Master System games, separated the UI into a portion of the screen with a Black Background... it wasn't always about trying to improve performance by reducing the Draw Area of the Game; it's about keeping the UI Readable.
Especially when you have a Mountain of Text for a Description of something.

If you want to understand best practises... go study a bunch of NES Games., and I'd play them on a CRT Television as well; as you can visually understand why they were designed that way., that's something very difficult to mimic on a modern progressive led display that provides pixel perfect images.
Grumpydlw
10
Years of Service
User Offline
Joined: 2nd Nov 2013
Location: Las Vegas, Nevada
Posted: 30th Aug 2022 00:12
Thank You BUT that is not the problem.
I want text to appear in my VR view.
Note that I have Appliances and Misc displayed across the top of the view.
Then white box below it is where i want to create 11 lines of text.
I really don't care if the box is black or white or invisible.
My preference is Black Text, invisible background.

As mentioned above I would like to Text or Print them to an Image I can then Put on the box.
But on the fly.
I don't really want to install that many images into my program.

GetImage isn't working.
RenderToImage isn't working.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-04-25 16:53:00
Your offset time is: 2024-04-25 16:53:00