• All submissions to this site are governed by Second Life Project Contribution Agreement. By submitting patches and other information using this site, you acknowledge that you have read, understood, and agreed to those terms.
Issue Details (XML | Word | Printable)

Key: VWR-173
Type: New Feature New Feature
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Haravikk Mistral
Votes: 33
Watchers: 6
Operations

If you were logged in you would be able to see more operations.
1. Second Life Viewer - VWR

Don't render invisible prims

Created: 01/Mar/07 07:46 AM   Updated: 30/Sep/09 01:31 PM
Return to search
Component/s: Graphics, Performance
Affects Version/s: 1.13.2.15, First Look - 1.13.2.57278, 1.20 Release Candidate, 1.22, 1.23
Fix Version/s: None

Environment: n/a
Issue Links:
Relates

Linden Lab Issue ID: SL-37532


 Description  « Hide
Simple suggestion. Basically any invisible prim (a prim which can be determined to have a fully transparent alpha map, or more easily a transparency of 100%) should not be rendered by the client except when highlight transparent is turned on.

As mentioned in VWR-172, spheres seem to have a larger than before performance hit in current versions, this occurs even when the spheres are fully transparent, meaning they are still rendered when they have no need to be.

There is a surprisingly large amount of in-world content that is actually invisible until needed, or is simply never needed (e.g detection volumes). There is no need to render these at all; invisible faces could be removed, or entire objects ignored if they are fully invisible.



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Lex Neva added a comment - 01/Mar/07 09:57 AM
Agreed! I've been using a script to set invisible things 100% transparent rather than using a fully transparent texture for most of my time in SL, on the vain hope that maybe someday, they'll add an optimization like this.

gearsawe stonecutter added a comment - 04/Mar/07 01:52 PM
I would much rather have a special texture or property of the prim to not render. There are several displays that use 100% alpha prims in a grid pattern over a texture to work as a touch screen. If there is nothing to render there would be nothing to touch. There needs to be more thought behind this before implementation. It has the possibility to break content if changed. I think a property to not render would be your best solution and this would need to be accessible to scripts. You see this idea in many other games. There is also the problem of griefing. Would you be able to see these objects when Highlight alpha is turned on?

Right now we use the spacial system texture to make invisible prims. We see it as transparent but the property is Opaque. They there should be something that could be made.


Argent Stonecutter added a comment - 08/Mar/07 06:02 AM
I made this same suggestion before, and I've voted for this, but I agree with my fellow Stonecutter, this should be a special texture (and it and the invisiprim textures should be put in the Linden library!) rather than a "100% transparent" setting.

If we were starting from scratch I would recommend making "100% alpha" unrendered and making special hidden prims "almost 100%", but there's too much content that would be broken by just making 100% alpha unrendered.


Argent Stonecutter added a comment - 08/Mar/07 06:14 AM
See VWR-185 for an alternative implementation possibility.

Torley Linden added a comment - 12/Mar/07 12:42 PM
I wonder why build tools > Texture tab > Transparency only goes up to 90%? Makes it too easy to lose objects otherwise?

Haravikk Mistral added a comment - 21/Mar/07 06:05 PM
@Gearsawe
In that case I agree, forgot about those. Following that; I still think that 100% alpha, or objects/faces/polygons with 100% alpha textures, should not be rendered, however they should always be downloaded so that touches can still be calculated. Thus, when you click the object is still 'there', but the renderer, LOD algorithm and so-on never receive it.

This way touches still work with existing content AND the renderer doesn't get bogged down processing things that can't be seen anyway. An additional flag therefore would only be required to facilitate the creation of non-clickable items, which would be a new, separate feature.


Haravikk Mistral added a comment - 07/Apr/07 09:51 AM
It occurs to me that the patch for this could actually be incredibly simple, however I've no real experience with building source-code in the way SL requires, so it'd require a full day I think to familiarise myself which I don't really have.

Anyway, what I'm assuming is;

  • Detection of touches is independent of the rendering of object (no evidence here)
  • Objects are passed in for rendering (judging by occlusion culling as only objects that are definately visible are passed in)

Thus the fix in this circumstance is simple. In the code where objects/primitives are passed into the renderer, all that is need is a simple if statement (pseudo-code):
if (highlight_transparent || (faceAlpha > 0.0)) then render(currentFace);

ie; the above additionally assumes that individual faces are passed in (e.g along with texture data), if this is not the case then objects will need to have their average alpha value calculated as they download (or are updated) so that it can be easily queried.
This however will simply result in any object or object face which is fully transparent from ever being rendered unless highlight_transparent is enabled (in which case it's going to have a red highlight to it anyway).
Of course this hinges on touches not using rendering information to determine what has been clicked, I'm assuming atm that touches are calculated by working out a line perpendicular to the user's camera at the position they click and seeing what the first object that line collides with is.

I have no idea of the structure of the SL code though, so all this is probably easier said than donet could lend itself to greatly improved performance in well constructed areas (ie areas that use transparency on sides people can't see).


Delerium Hannibal added a comment - 10/May/07 02:45 AM
If you've ever coded before, then you know that if statements carry with it a certain overhead. I can't see how running a check on each prim with IFstatements to see if it's visible would give much more of a performance increase other than just leaving it alone in the first place. Your talking about two different processes here:

1. IF statement run against every object rendered. This is dealt with by the slow processor in the PC, and has to be checked for each object.
2. render the prim. This is handled by the FAST GPU in your graphics card, and generates very little slowdown, but adds up the more prims you have.

The problem you run into is the fact that there are FAR more renderable objects than completely alphaed ones, so the check gets run needlessly at least 80% of the time, which increases processor load. Would it balance out? who knows, but just wanted to point out that every function call (IF statement) has it's cost. No matter how small that cost may seem, when run thousands of times per frame (one for each object in view. Could fluctuate), this could get very costly. Now, factor in FACES, and you've multiplied the checks by a magnitude of 1 to 6.


Haravikk Mistral added a comment - 22/May/07 10:18 AM
This doesn't need to checked every time a rendering pass is made, only when an object enters or leaves the current visible scene, if the object is invisible, then don't add it to the scene, and instead only consider it when the client avatar wants to touch something. At worst this adds 1 to 6 or so IF statements for objects entering/leaving the scene (or changing within the scene), which compared to a high-frame-rate is relatively few checks.

I'm not 100% sure how SL handles it's geometry, but, if we assume that when an object enters a scene a geometry object is created somewhere in memory (which can then easily be passed in for rendering, and be processed for LOD), then all we need to do is remove invisible faces from that geometry when it is created/updated. Assuming 1 in 20 prims update every second, that's a ton of prims left over that are only processed once.
Add to this the fact that the checks don't even need to use floating-point arithmetic, as the floating-point checks can be done as objects download/update and stored as a boolean somewhere.

Considering this we can assume that for every 30 frames, maybe 1000 boolean checks are likely to occur on average, and that might be a pretty high guess, as many scenes don't change that frequently. Even if your avatar is turning around as fast possible, how many new objects are going to appear per frame? I'm thinking not enough to result in any significant number of checks being required.
The end result is that the cost of culling a prim doesn't need to be very high at all, compared with the cost of rendering however many hundreds of triangles it may be composed of (all which need to be lit etc.)


Argent Stonecutter added a comment - 09/Aug/07 01:26 PM
I don't think the assumption that rendering is unrelated to touch is valid. It has to calculate the mesh for the object and perform raycasting or equivalent to determine if you've touched an invisible object... and I strongly suspect that the GPU is used to do the work.

However, the client CAN distinguish "transparent" from "transparent with a touch event" and use that to decide whether to render the face. Going forward, though, I think a special texture is much more practical. If that texture (as well as a common "100% transparent but not invisible" texture, and the invisiprim textures) are added to the Linden library it's also just as easy, and more efficient for the client to simply compare the texture ID to that list.

I'd also like to see Coadey Concord's free alignment texture added to the Linden library.


Haravikk Mistral added a comment - 16/Aug/07 03:03 PM
I'm not sure that touch would use raw data in the GPU though, unless the entire 3d scene is held in memory for calculating touches. I'd imagine it would be more of a case of using Occlusion Culling data or similar methods to pull out likely objects and then do ray-tracing on them, maybe it's done on the GPU but I dunno, we'd need a Linden or someone who's done a lot of digging in that area to clarify as I've noticed that a few updates back touches started taking into account alpha on textures (ie if you have a ladder texture then you can click things through it by clicking the transparent bits, but this is not the case in edit mode), this was what caused trouble with 100% alpha buttons/HUDs a short while back.

So in other words; I don't know either way, but I'm still fairly confident that any data used would only be pulled out as needed and ray-traced then, meaning touches would still be distinctly different to rendering the scene, as it seems impractical to use the entire scene's data for touches when they only come every few frames.


Zeph Wiefel added a comment - 08/Dec/07 09:25 PM
Working on it
  • Zeph Wiefel

WarKirby Magojiro added a comment - 03/May/08 08:15 AM
I'm bumping up the priority on this. With the introduction of Avatar Rendering Cost in 1.20 , we find that alpha affects that value drastically. 5 points for every alpha face. This means an invisible object adds 5*total number of faces to the AR.C Now when you take into account 150 or so prim swords that are invisible until unsheathed, there's a problem

I think the idea of a "do not render" prim property would be good. Script settable, of course. And with some way in the client to see objects marked as such, just in case.


Geneko Nemeth added a comment - 04/Dec/08 07:35 AM
With 1.22 no longer using off-screen buffer rendering but ray casting to accomplish picking, maybe this would be easier to implement now, since geometry wouldn't have to have be rendered to be touched.