From the outside to the in... huh, where is my house? :(

What is the best way to make a house appear both, from the in- and the outside?



Set backface culling off? Just make an inner and an outter model? ( Thats the approach i would use atm, but hell. i would have to do all the work again… :D)



A simple question i didnt find an answer for. :confused: Thanks in advance!

By




KuroSei said:
Just make an inner and an outter model? ( Thats the approach i would use atm, but hell. i would have to do all the work again... :D)


... I think you mean you did model the mesh with two face "in and out" ... In most case, that's the perfect choice. You don't have to double the work, let say you have a house wall, look good outside , then inside you just duplicate the mesh and turn the normal back (that not sounds like difficult isn't it)...

And in complex in house scene, there are furniture and other stuffs , how can we make it visible without modeling it? :p

The work is not the problem, but the fact, that it virutally doubles the vertices.

To flip the normals on the duplicated mesh is not the problem. I guess i can do that. :wink:



Just to explain the “inner-outer-model” thing:

I just thought about making the outter appearance of the house visible to the outside and model the inside into that shape. So I have basicaly two models. One visible from the in, one visible from the outside.

I’m sorry but I’m trying really hard to visualize but I can’t see it. Could you post a picture please of what it looks like?



jME is supposed to do back-face culling automagically (unless you change the settings). So, basically, if a plane (face) isn’t toward the camera (not even a tiny bit), it shouldn’t be drawn. So if you look at the front of your house, the back wall should not be drawn. Same thing for most shapes. If you have a cube perfectly aligned to the camera, all faces except the one facing the camera won’t be drawn at all. (At least as far as I know).

Also setting the face culling to non (every face are displayed), won’t resolve the problem of normals that will always face the exterior, so your model will be wrongly lighten inside.



The way to go IMO is to model the inside too.

I know. And its good that way.



My problem is the following:

Imagine a house which you can enter without reloading the scene. So its just a hollow model to be precise.



Due to backface culling the inside or the outside wont be drawn which makes this approach a bit crappy. :slight_smile:

So i have two options:

  1. Disable backface culling. ( Not a good approch i guess. )


  2. I create 2 planes per wall: One for the inside, one for the outside. AS far as i informed my self the last few hours this is the approach most games usw atm.

    But it doubles the vertices, since you dont need one plane but two planes per wall.





    And modern programmers try to keep the vertice number low while granting the best level of detail possible.

    So I’m kinda searching for alternatives…

Explain why that’s “crappy”? If the camera don’t see the wall it won’t be drawn. The player won’t see the wall either. There’s no point in drawing the wall at all. That’s how modern engines work. What doesn’t face the camera doesn’t need to be drawn.



If you have an Xbox and play a very detailed game with high resolution textures and suddenly turn around (everything behind the player is usually culled because it’s out of view) what happens? You distinctly see the textures load, the model’s LOD from farthest to closest (in some cases). I’ve seen that on PC games too but that was mainly older games with high resolution textures when they weren’t that used.



My point is, unless you have a reasons to have ALL the inside walls of your house drawn even when the player isn’t looking at it, there’s absolutely no need to force cull to none. The worse case scenario is that if the door is opened, or there’s a gap around the door, only the inside back wall of the house will be drawn which is essentially the same as having a hallway ending in a T.



But then again, maybe I’m misunderstanding what you mean.

I’m well aware what backface culling is, what it does and why one uses it. :smiley:



The only thing i want to know is what is the best way to make a house i can walk into without doubling my meshsize. Or maybe there is a way which makes modeling the houses easier… Making two plains per wall really raises the effort one needs to model a house… :smiley:

Have you ever played Oblivion? Or Left 4 dead? Houses are made of hollow blocks that they detail then put models inside the house, textures, decals, spites, particles. jME can do that too but I can guarantee you that if you’re forcing cull to none for everything, your scenes won’t have much in them because the FPS will be abysmal.



If you want to make a house into which you can enter and exit without loading/exiting a scene there’s no other way. You can either make your houses models (3DMax or otherwise but I’m not entirely sure about those with jME and how they’re manipulated by the engine) or using blocks the way the Source engine or id Tech 4 and many other engines do.

You are concerning about the number of vertices in you scene, so I’m talking it here for other to correct it too if i’m getting wrong :



Say if you have 100,000 (one hundred thousand) of simple box (wall panel) and then you concern about there are 2x6x100,000 of triangles and how many vertices are there … Is not nessesary unless you rendering your mesh in a memory-low device… As you say we need a good method of clipping and culling what is un-seen… For the “in and out” problem you mention above, I’m not understand clearly but I just thought you want a “portal culling system”?


ust to explain the “inner-outer-model” thing:
I just thought about making the outter appearance of the house visible to the outside and model the inside into that shape. So I have basicaly two models. One visible from the in, one visible from the outside.


About portal, it's very handy in the situation that I guess you talking about. And the implement is easy also... :p

My usual approach is a "box trigger", which is placed in the front door of the house, when you enter the house, you enter the "box" and "a trigger" call the system to hide all the spatial in the "outsideNode"
Next time you enter the "box trigger" the reversed operation are done!

Tell me if you want some more help, I'm have my working code but it's in the progress of refactoring and cleaning so I will post it later.

@KuroSei: There’s another thing to consider though if you’re worried about how crappy some things look. If you make your walls only 1 polygon instead of a rectangular prism when you go through a doorway the walls are going to be paper thin if you look at them edge wise. Really the best way is to model a house roughly like how you’d build on in reality. Outer cladding (bricks, siding whatever), a void for insulation (which is empty space in this case) then the inner walls (dry wall, tiles, shag carpet depending on your sense of style).

atomix said:
My usual approach is a "box trigger", which is placed in the front door of the house, when you enter the house, you enter the "box" and "a trigger" call the system to hide all the spatial in the "outsideNode"
Next time you enter the "box trigger" the reversed operation are done!


This is usually referred to as "hint brushes" in Source and id Techs engines. It basically tells the engine to threat that brush as an opaque wall and not draw anything behind it. It usually is bound to a door, but not always. When it's on a door, opening the door effectively opens the portal thus rendering everything beyond it. In very short that's how it's used. It's more complex than that of course, but that's the gist of it.

http://developer.valvesoftware.com/wiki/Hint_brush

@madjack … It’s pretty much the same, :stuck_out_tongue: but now I know there is another name of this technique.



Anyway, the PVS things are more complex than the method i mentioned. I didn’t do any research about this area yet but is there any PVS done in JME in the past?

Not that I know of. PVS can become quite complex. Besides, I think it’s too specific for FPS genre and should be implemented by the team/person working on specific game than a “generic” PVS system.



Although we could argue openGL/jME does its own PVS by back culling but I think that’s too general to really call it that, but again it is part of it.



I’m sure if someone would offer a solid generic PVS it would be included in the library.



If I’m wrong I will be corrected.

Wow. I didnt expect this much traffic in this topic. oO

But I guess my question is cleared now. If i tumble over another problem I will ask again.

I like the door-trigger idea pretty much, btw. Lets see, what the performance difference is later on. First I have to model a new house though. :smiley:





Thanks, everyone! You really gave nice hints.

Actually you could make stuff similar to the door very easy,just test for the distance every x seconds(or on move of camera) and blend the inside model in when the player comes nearer. (preferably loaded in a background thread)

Fixed triggers are better i guess, since multiple houses mean multiple checks per second.



I know: My project WONT be big enough to make even my crppay hardware sweat much when it comes to vertexcount and my cpu can handle some checks per second. ( The only thing it dosnt like is texturespace… Wow. Its so crappy when it comes to textures. Its slow and has tiny ram… )



But when i learn something i want to learn it right and good for future proposals. So i try to make things as efficient and good as it is possible for me. :slight_smile:

You mean like precompiled aka BSP? Cause else the source enigne does the sameas I say, only the checks are in te collision engine.