Pages: 1 2 »
  Print  
Author Topic: 3D Performance  (Read 10295 times)
Offline (Unknown gender) time-killer-games
Posted on: November 23, 2014, 03:22:03 pm
"Guest"


Email
You know the drill I'm still perma-banned from the GMC over stupid crap from 2-3 years ago so this is the only other place I can go for this kind of assistence.

I'm porting an old 3D game of mine to OUYA and was able to take it from 0.5 frames per second to about 2 FPS by replacing ellipsoids  with walls that always face the camera. Since the texture of the wall is really just a screenshot of the original sphere, that's not even a fraction of the original polys and it looks vitually Identical, even the lighting. The point lighting only came from one place, a camera that rotates in the center of the perfectly-square room without ever changing x/y coords (third person). So yeah every sphere's lighting appearance looks pretty darn the same regarless of where the model was located in the room. Note there are a ton of these spheres simultaneously present in every room so changing them to walls really helped big time.

Then I made the walls into a tiny precompiled d3d model loaded and defined at game start. Then I resized the application_surface to render to 800x600, which is the smallest, lossless resolution I can make the game have when running on the big 1080p TV screen via my OUYA. Any smaller and the game's graphics look hideous on the screen. (When the application_surface isn't resized manually, it renders to the default 1080p display of my TV). So this made the game raise from 2 FPS to 4.5 FPS. Better, but I don't know what much else I can do to make it run at a normal speed. The OUYA is Android, and a very weak Tegra card. it runs 3x as fast on my nook tablet and samsung phone.

My qestions...

1) Are loading external model files any better than code-defined models? I'm not talking about d3d_draw_[insert_primitive] I know that will kill the perfomance. I mean defining the global models once in the create event / game start event instead of dynamically every draw frame.

2) Is the 3D lighting what is causing my game too be so slow? This will destroy the look an feel of my game if I disable lighting and it will look terrible like that. There's only like three light sources in use!

Keep in mind the poly count total in every room is incredibly low in 3D indie game standards (even for GameMaker and/or OUYA ones).

THANKS. :D
Logged
Offline (Unknown gender) lonewolff
Reply #1 Posted on: November 23, 2014, 06:21:46 pm
"Guest"


Email
Start a new account over there (I did - LOL  :D)
Logged
Offline (Unknown gender) time-killer-games
Reply #2 Posted on: November 23, 2014, 06:55:25 pm
"Guest"


Email
I wpuld if that wouldn't get me in more trouble. They made it clear they don't want me back.
Logged
Offline (Unknown gender) daz
Reply #3 Posted on: November 23, 2014, 08:38:10 pm
Contributor
Joined: Jul 2010
Posts: 167

View Profile
Ouya was never a very powerful device to begin with. I wouldn't recommend bothering with it at this point, with the Amazon Fire TV, and Android TV (Nexus Player) now coming out.

Lights are the most likely culprit. If it's using per-pixel shading, you'd need to see if there was a way to switch to vertex based for performance. Dynamic lights in general are pretty heavy, which is why popular game engines now have static and dynamic lighting. Not something I see GM ever doing though, honestly.

If you have any shaders... drop those immediately.

The resolution is another big factor. Bump your game down to 720p and you'll get a lot more done. Only the very basics of 3d games can be run on the Ouya, which is why you see so many 2d ones. Try to lower your poly count across the board, and you could try lowering the resolution too. Keep in mind GM doesn't have any sort of occlusion culling built in, so if you have any sort of large 3d scene, you'll have to do that yourself.
Logged
Offline (Unknown gender) lonewolff
Reply #4 Posted on: November 24, 2014, 01:00:40 am
"Guest"


Email
I wpuld if that wouldn't get me in more trouble. They made it clear they don't want me back.

'more trouble'? What are they going to do, get the legal team on to you?  :raise:
Logged
Offline (Unknown gender) TheExDeus
Reply #5 Posted on: November 24, 2014, 06:23:17 am

Developer
Joined: Apr 2008
Posts: 1860

View Profile
1) If you don't render the model anymore, but a billboard, then why you still do lights for that? Isn't the lights pre-rendered in the image?
2) You must make a model, that is the rendered with d3d_model_draw(). It doesn't matter if you do it at runtime (which should be easy, as it is a billboard) or if you load it from a file. Both will be equally fast, as the model is always the same.
3) How many draw calls you do you have? And how many vertices? Even if the vertices are little (four), you will still have a large overhead if it renders every model separately. Another thing is culling. As the billboard always faces you, then enable backface culling, as you will never see it. Also, you need 3D culling, so you render only those you actually see. This also applies to walls and other things.
4) If you use shaders, then try not too.
Logged
Offline (Unknown gender) daz
Reply #6 Posted on: November 24, 2014, 03:01:45 pm
Contributor
Joined: Jul 2010
Posts: 167

View Profile
I really doubt GM has any sort of draw batching, so drawing the same model 100 times would probably still result in 100 draw calls... unless the GPU was smart enough to realize it still had the model in memory, but it's likely GM will still be pushing the same model through. I don't think Enigma is any better in this regard either. But yes draw calls is a good one, forgot about that.

GM doesn't really have any good profiling though, especially for 3d.
Logged
Offline (Male) Goombert
Reply #7 Posted on: November 24, 2014, 03:09:21 pm

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
GM: Studio batches as many draw calls as it can and so does ENIGMA now. I also wanted instance batching for subsequent model draw calls which Studio does not have and Dailly snubbed me when I told him about it but Harri's implementation is in limbo I guess.
« Last Edit: November 24, 2014, 03:11:42 pm by Robert B Colton » Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) time-killer-games
Reply #8 Posted on: November 24, 2014, 04:52:40 pm
"Guest"


Email
@wolf - they'll ban me for much longer. forums 101. Trust me. They dont want me to give them more reasons to ban me, that
includes ignoring their wishes they expressed about me not visiting there anymore.

@daz & Harri I'm reducing the lighting by not effecting all static meshes so hopefully that should help. Thanks for the help and insight! :)
Logged
Offline (Unknown gender) TheExDeus
Reply #9 Posted on: November 24, 2014, 05:19:20 pm

Developer
Joined: Apr 2008
Posts: 1860

View Profile
For draw call profiling and stuff you can use existing tools like ApiTrace. In this case you will need to pray that the implementation on Windows is basically the same as on Ouya, which it probably isn't.

Robert B Colton, I have not even though about adding instancing yet. I doubt I will do it any time soon.

It's not really easy to batch d3d_model_draw call's though. You might be rendering the same model, but you render with different transformations. So you either do instancing, or you manually transform the vertices on CPU and add to one batch. But it's possible to batch d3d_model_draw functions if they are a one time thing, like if the balls are not moving or added/deleted, then you can add them together in a single mesh. Won't work with the billboards though, as you still need to rotate them to face the camera. Then you can do something very sneaky though - you can technically draw them as 2D sprites on screen, which GM and ENIGMA batches. Occlusion should still work, if the z axis is changed.
« Last Edit: November 24, 2014, 05:22:23 pm by TheExDeus » Logged
Offline (Unknown gender) lonewolff
Reply #10 Posted on: November 24, 2014, 05:58:29 pm
"Guest"


Email
@wolf - they'll ban me for much longer. forums 101. Trust me. They dont want me to give them more reasons to ban me, that
includes ignoring their wishes they expressed about me not visiting there anymore.

How can you be banned longer than 'Permanently'?  ???
Logged
Offline (Unknown gender) time-killer-games
Reply #11 Posted on: November 24, 2014, 06:52:18 pm
"Guest"


Email
Its pretty straight forward. They call it permanent. But people can change their mind over a good number of years if I can prove I'm not making the same mistakes and they notice that.
Logged
Offline (Unknown gender) lonewolff
Reply #12 Posted on: November 24, 2014, 07:12:26 pm
"Guest"


Email
So you figure that one day they will just reverse the ban out of their good will after a 'good number of years', for a user they have long forgotten about? Not gonna happen.

I'd say start fresh, with a new account, keep your nose clean, and they'll never be able to associate you with the banned account.

But, if you'd rather just wait and hope for 2021 to come and hope they have some sort of amnesty and unban all old accounts, long after Unity has bought out YYG, that's your choice ;)
Logged
Offline (Unknown gender) time-killer-games
Reply #13 Posted on: November 25, 2014, 11:48:55 pm
"Guest"


Email
@wolf

we'll never agree on that so theres nothing to discuss

@daz&harri

I disabled the lighting on specific models but they still look the same as with lighting because I modified the different shades of brightness each polygon had, which was pretty easy to do with the model being a simple cube. That object is used a lot in every  level, its a basic collision block so that raised the FPS to about 5-6 (a guestimation).

Then I enabled culling on all models. Raisted the FPS to 8. That was perfect.

I have another idea that may fix it up a bit more.

Would using d3d_set_hidden() help much? I read the doc so it basically prevents polygons not visible in the current projection from being calculated so I'm gonna try this out tomorrow and hope that will be another step in the right  direction.

Do I set d3d_set_hidden() for the camera object or do I have to do it for each model object I want it to apply to individually?
« Last Edit: November 25, 2014, 11:59:53 pm by time-killer-games » Logged
Offline (Unknown gender) lonewolff
Reply #14 Posted on: November 26, 2014, 12:02:35 am
"Guest"


Email
@wolf

we'll never agree on that so theres nothing to discuss

Agreed  ;)

Someone seems to have learned nothing about dealing with humans in his month off.  :D

Have a fun life  (Y)
Logged
Pages: 1 2 »
  Print