Game Development Community

Prefabs don't hide

by Nils Eikelenboom · in Torque 3D Professional · 07/10/2013 (8:07 pm) · 15 replies

I noticed prefabs don't hide if hidden is true.
Is it a bug or is there a reason?

I-dropper.net/torque/prefab_hidden.jpg

#1
07/10/2013 (11:47 pm)
Hello Nils Eikelenboom,

Actually, "Hidden functions" for prefabs are not working, at all, either via World Editor or console in MIT Torque 3D 3.0.

However, while the official patch does not happen, you might try the solution shown in the video below: Here is the link:

https://dl.dropboxusercontent.com/u/64612150/PrefabsHiddenIssueFix/PrefabsHiddenIssueFix.html

Please note the solution shown in the video above maybe it does not be the best one for this issue, since it's just a temporary solution.

Enjoy!
#2
07/11/2013 (12:36 am)
Hi @Joao, thank you very much for your reply! You made a nice video about this how to solve the issues around this. It could be helpful in some situations.

However, I was debugging pretty large prefabs, with around 80 objects. Needed to quickly get them out of the scene to check if those were the cause of issues (drop in FPS). I just deleted the prefabs.
#3
07/11/2013 (8:21 am)
Ah - for that purpose it might be easier to use simsets. Just add a simset and drop those things in it, then iterate through the set and hide/show your objects.
#4
07/11/2013 (1:18 pm)
@ Nils Eikelenboom,

Sorry, I did not know about how many objects your prefabs had. However, prefabs with approximately 80 objects are an extremely huge stuffs. In fact, it is practically almost a complete game level turned into prefabs.

Anyhow, with that massive amount of objects to compose your prefabs, the solution proposed in the video in my previous post is actually completely unviable, but fair for prefabs with few objects.

It's sad to say, but considering the current development pace (slowly) that the Torque 3D is having at this time; I think that not only a solution for the problem of the Hidden function for prefabs as well as others out there, will take a long time to get out the box if there will be any, at all.

Off topic, however in my opinion, I could be wrong, because I am not the master of the truth, but delegate the bugs fixing and the development of a complex software as a game engine on the shoulders of his community, believe me or not, is an extremely risky decision, with unpredictable consequences, unfortunately.

All the best,
#5
07/11/2013 (5:52 pm)
I'm probably wrong, but can't we just uncheck isRenderEnabled?
#6
07/11/2013 (9:59 pm)
@Richard; You mean SimGroup? ;P
Tried to hide the simgroup but no such luck!

@Dan: Even unchecked it's still there :)

@Joan: Don't be sorry. Any input here is welcome and appreciated. Trusting the community to further develop & fix the engine comes along with being open source I guess. The positive thing is once you produce and sell something with a bit of luck; the game engine owners don't come to take all hard earned money :)
I don't think 80 objects is a lot. 3d game levels can contain thousands of objects. If I look at the forest objects in some of the levels I designed I can't (won't) even count the 3d objects contained but only look at memory load and such.


I'm using a technique to design levels and their objects in a modular way. Breaking down objects that contain iterated geometry if placed as a whole into smaller building blocks could be a way to reduce memory load and loading time. For example the big shiny box in the picture (a petawatt laser compressor) has a lot of door handles:

i-dropper.net/torque/prefab_hidden2_small.jpg[+] enlarge | Note: if you zoom in and look closely you can even see the different LOD's of the door handle object

The box and the door handle are in this case separate objects. That means that T3D doesn't have to load 32 times the geometry of that handle but only once and repeat that another 31 more. Also can you have different LOD's (and imposters) for each object. Prefabs should be THE objects to create this; so you could have just one big laser compressor in the example.

Only I'm getting the impression that I'm touching T3D's boundaries with this one. In UDK for example, you can really gain a lot with this technique. But for T3D I'm not sure. That's why I was testing it and needed to hide (and delete) the prefabs for a moment to monitor rendering.

I think I will need an expert to work with to look further into this if I want to use this way of designing in T3D.
#7
07/11/2013 (11:37 pm)
I know it's not helpful to the discussion at all so forgive me...but nice looking editor skin
#8
07/12/2013 (8:38 am)
This might be a silly question, but... Did you try deselecting them while on the editor? Even if you hide something, if you keep selecting it like in the picture, it will appear (so you can see which object you are selecting).
#9
07/12/2013 (3:01 pm)
@ Nils Eikelenboom,

Thank you for commenting my previous post and good luck with your project, and I hope you may successfully resolve the memory optimization issues of your project in Torque 3D. Besides, a pretty nice industrial machine room scene depicted in your screenshot with great 3D models and excellent scene lighting. Editor skin looks good, as well.

@Dan Webb, Oscar Velzi,

Nils are correct, uncheck 'is RenderEnabled' and keeping 'hidden' unchecked (default option) prefabs won't be hidden, although with a single object, not prefab, it will be hidden, but its mesh remains active and with collision enabled, also.

When an object is hidden it should be temporarily removed from the scene, including its mesh and therefore, it will not render or be collided with, but we have a situation: the property 'hidden' in the world editor is behaving similarly the property 'fade', where the object disappears, but its mesh is still active and can collide with other objects in the scene.

Try yourself, get an object with collision enabled and working and set its hidden property checked in the world editor, save your level and exit level. Reload your level and try to go through the object and see what will happen.

Besides, there are two possible bugs happening in the World Editor:

- The first, regarding to render for hidden objects;

- The second, regarding to collision with hidden objects;


The first one:

For example, you set 'hidden' checked for your object in the World Editor, and you keep 'is RenderEnabled' option checked (default option). After that, save your level and exit level.

Next reload again your level and note that your object supposed set to be hidden to remain noticeable in the same place as before you have saved your level.

Returning to World Editor, mysteriously the previous object that was visible in the game scene, turns hidden as supposed to be. This could ruins your game play if all hidden objects in your game scene show up at once when you level starts.So, why does 'is RenderEnabled' option was set unchecked in the video? Because I have found if you do that and save your level, leave it and play it again, now when the game starts your object will be hidden as supposed to be, and it will remain invisible also if you access the World Editor. This seems to me have solved the render problem for hidden objects, but its mesh is still active.


The second possible bug:

Furthermore, here we have another bug for hidden objects, this time, concerning to collision of them with other objects. Hidden objects would not ought have any collision property while being hidden. Unfortunately, this is not happening at this time; I mean the object is set hidden, but its collision system (mesh) is remaining enabled. Moreover, on the other hand, this bug is nice to make invisible walls or hidden fences.

I have posted these problems on GitHub Issue for Torque 3D, for several days, but no one seemed to care much about that. It's like you trying to preach in the middle of desert. Since nobody cared, I closed the issue.

Having someone reporting a number of possible bugs on GitHub Issue for Torque 3D and do not have anyone to solve them or make an analysis of the problems is simply a waste of time. It's sad to say.

No offenses, it seems to me that at this time the development of the Torque 3D is operating on autopilot, and the pilot is taking a nap.

I hope now people may understand better the reason why 'is RenderEnabled' should be unchecked when the option hidden has been checked.

This is my last post about this subject.

Thanks a lot!

Greetings,
#10
07/12/2013 (3:16 pm)
Quote:
@Richard; You mean SimGroup? ;P
Tried to hide the simgroup but no such luck!

No, I meant SimSet. An object can only belong to one SimGroup at a time but can belong to multiple SimSets simultaniously.

And to hide it you're stuck iterating through the members and hiding them ->
%count = %setName.getCount();
for (%i = 0; %i < %count; %i++)
{
  %setName.getObject(%i).setHidden(true);
}
#11
07/12/2013 (4:58 pm)
@Joao: A few points:

1). If you create an issue report on github, feel free to leave it up, even if it doesn't seem to be getting any attention. Someone may be working on a fix but not post until it's finished. Or maybe others will run into the same issue months from now and be able to spark a discussion.

The point is, every issue report has the chance of being useful but deleting them before they're resolved removes that possibility.

2). I'm investigating the issues with isRenderEnabled/hidden.

isRenderEnabled is designed to be used in situations where you need to hide a mesh but still have collision capability. It's ideal for doors, for example.

hidden is designed to completely remove an object from the scene/sim without outright deleting it. That means it isn't rendered, doesn't cast shadows and is removed from collision detection.

What I've found so far is:

a). isRenderEnabled works (at least on TSStatics, haven't checked other object types). It stops the object from rendering without removing collision, even after mission reloads. The catch is you have to deselect the object in the editor in order for this to take effect. Simply unchecking isRenderEnabled won't immediately cause the object to stop rendering. This is probably an easy-ish fix but it's not high on my todo list.

b). hidden also works (again, on TSStatics). It completely removes an object from the sim, including disabling collision. The reason you can still collide with a hidden object is because the Player class caches nearby collision geometry. Instead of constantly querying for collision polys (which can be expensive), the Player class simply queries once and maintains a poly list. This 'list' is only updated when the player has moved a certain distance.

This caching effect can be disabled (I did it for a game prototype months ago) but you'll take a performance hit. This should probably be a setting in the player datablock. Maybe I'll post the necessary changes later this weekend.

3). The Torque engines can only be on auto-pilot if the community allows it. Everyone that uses T2D or T3D has the option to be active and give back. Some can and will, others can't or won't. Regardless, whatever happens to the engines from here on out rests on our collective shoulders.

#12
07/13/2013 (12:28 am)
@Chris Haigler,

Thank you very much for your post, I appreciate that, and also I do not mean to sound rude or ungrateful, but you no longer need to bother with that. I am not any more interested in this issue about the hidden object in Torque 3D, if there is a bug or not.

Anyhow, many thanks again!

Cheers,
#13
07/13/2013 (2:16 am)
Quote:
I am not any more interested in this issue about the hidden object in Torque 3D, if there is a bug or not.

Others might be, Joao.

I might look into a fix (I think it should be fairly trivial) later this week. Will mark the thread for notification.
#14
07/13/2013 (7:55 am)
Thank you all deeply for helping and getting in to this. It is much appreciated!
#15
07/13/2013 (7:58 am)
@Richard; nice one, will try it out when I get home / office. (Couple of days) Thanks!