✨ Feature Requests

  • Search existing ideas before submitting- Use support.secondlife.com for customer support issues- Keep posts on-topicThank you for your ideas!
Performant and quality 2D text drawing routines
Note: This issue was previously accepted on the JIRA as BUG-231731 in 2022. Resubmitting it to the Canny because I think the idea has been lost in the move. The feature requested is a high performing set of functions that can draw text onto prim surfaces. With multi-line support via \n, measured font sizes, batched draws, and baked font styles compiled into the viewer engine. Restrict this feature to face 0 of the LINK_ROOT prim in an object. A maximum arbitrary number of "screens" could be allowed per region. The maximum limit of llInitDrawString calls per region could be set to for example 256. Attachments would not contribute towards this limit. Styles baked into the viewer originating from ttf: integer FONT_STYLE_DEFAULT = 0; // e.g. arial integer FONT_STYLE_ARIAL = 0; integer FONT_STYLE_CANDYSCRIPT = 1; integer FONT_STYLE_SHELLEYALLEGRO = 2; integer FONT_STYLE_BAUB = 3; LSL prototypes: llInitDrawString(integer fontstyle) Initializes the text context. If this is called again with the same style it should silently return. If called with a different style then change the style. In C++ call initialize the opengltext to delete the previous glyphInfo. If the GLSL program is already linked it is reused. parameters: fontstyle: Uses an integer of FONT_* constants that reference baked fonts llBeginDrawString() Begins drawing. float llMeasureString(string text) Measures the size of the string. parameters: text: The text to draw return value: The measured size. llDrawString(x, y, text, color) Draws the string at the position and color. parameters: x: x position y: y position text: the text string color: the color llEndDrawString() Swaps the buffer onto the face of the prim. Note: llBeginDrawString just sets an integer in the C++ code to 0. Example SL script: drawMyStrings() { vector pos1 = <0, 0, 0>; vector pos2 = <0, 30, 0>; vector pos3 = <0, 60, 0>; vector color1 = <1,0,0>; vector color2 = <1,1,0>; vector color3 = <0,1,0>; string text1 = "Hello World!"; string text2 = "It worked."; string text3 = "This is a\nmultiline string."; vector sz1 = llMeasureString(text1); vector sz2 = llMeasureString(text2); vector sz3 = llMeasureString(text3); llBeginDrawString(); // This draws "Hello World!" on the first line. llDrawString(pos1.x - sz1.x * 0.5, pos1.y - sz1.y, text1, color1); // This draws "It worked." on the next line. llDrawString(pos2.x - sz2.x * 0.5, pos2.y - sz2.y, text2, color2); // This draws "This is a" on the third line and "multiline string." on the fourth. llDrawString(pos3.x - sz3.x * 0.5, pos3.y - sz3.y, text3, color3); llEndDrawString(); } default { state_entry() { llInitDrawString(FONT_STYLE_DEFAULT); drawMyStrings(); } } The OpenGL C++ implementation to place in the viewer code to support this functionality is on github. A patch exists for gltext to for baking. In the viewer these can be looked up with FONT_* constants. The init of the ogl context per font for the text should be instanced once per object using llInitDrawString to be used for multiple scripts and prims without reinitialization. This is destroyed when the viewer releases the object. https://github.com/tlorach/OpenGLText There is a bakeFonts.exe for turning ttf fonts into texture atlases to ship with the viewer to bake the fonts and can be produced as .bin and .tga files with offset info. Or, baked into font_xx.h and font_xx_bitmap.h files that can be compiled. This solution does not require the freetype library.
6
·
tracked
Bring back the long draw distance project from 2005-ish
Not necessarily in the same form. I don't think you want to draw all the skyboxes, that's going to look like trash. There are two ways of doing this, I think, which don't expose skyboxes. One is a full solution that takes a long time, like multiple quarters to a year. The other, you could probably launch in less than a quarter with not too much effort, and possibly 100% client-side with assets you already have. (Yes, really.) What for? To drive interest, naturally. Perhaps to recapture interest of people who left long ago. To spur more exploration, which then causes random encounters, gives people Something To Do (biggest problem w/ user retention in SL), etc. This kind of change could get you mentioned in articles on gaming publications. It will definitely get you mentioned on social media. I notice that when I fly around very quickly, I can see terrain and water from quite a long distance, like a kilometer or so. There's no objects, of course... _But it isn't bad!_ I like it! Unfortunately, it goes away pretty quickly, and I'm back to smog alert-level draw distance. To me, the really good, fully-complete solution would be this: Select all objects in the space between terrain and some reasonable altitude, like terrain Z+50 or terrain Z+100. This includes linked objects, so if you're selecting everything within terrain Z+50 and part of a link set is poking up to 55 meters above terrain, you get the whole link set. Bake that into something like a .kml every so often (daily/weekly/etc), Google Earth-style. Apply reasonable LOD. Beyond draw distance, fall back on that .kml-like mechanism. It'll be a little outdated sometimes, but so what. All we see now is smog! Obvious consequence of this: skyboxes don't show up. :) That's the full-blown solution that takes months to engineer, but it's a solved problem in computer graphics, and has been for well over ten years. I can look at Google Maps on a $200 Chromebook, and see that .kml stuff (sides of buildings, etc) just fine. Now, you're thinking, that is one heck of a project. Is there a quick, easy win that gets us part of the way there, right quick fast in a hurry? Like, something that could be banged out in a matter of _weeks?_ Yes! Here is what I propose, to get the ball rolling, measure user feedback, etc.: Let the user specify that terrain/water can be loaded past the draw distance. How far would depend on empirical testing. Maybe the answer is 1KM. Maybe it's 5KM. A terrain mesh is a 256x256 image, so we're not talking about a huge bandwidth impact. (You already stream the map to the viewer, so it's not like this is some undiscovered territory.) The upper limit is, more or less, "what can we draw on a high-end graphics card without turning it into a slide show?" You could give users the option to overlay the terrain mesh with the overhead map tiles you're already sending. This would make the terrain look odd here and there, as people sometimes put "sprites" way up in the sky: ads, drawings of hearts, airport/road hub information, etc. Still worth trying. With this, you don't see skyboxes either. Win-win. Now, what about sims that aren't edge-connected, like the private estates? What if you don't want to show one private estate from another, or from the mainland? I implemented an A-star algorithm that would pathfind its way across the grid as it existed in summer 2003. It ran in LSL back when that was a 16KB affair, and it ran fast even then. It even had the ability to back its way out of blind alleys! The algorithm that tells you whether you can see a terrain mesh from where you are, given arbitrarily long draw distance, is just that, A-star or something like it, written in the 1960s, and capable of running on 1960s hardware. This is not remotely difficult, or CPU-intensive.
2
·
tracked
Load More