I was talking about textures atlases (i.e. group many textures in a single one and play with texture coords to keep the same result in the end - minus problems with mipmaps), i know that it’s possible with texture arrays. However, not all gpu supports texture arrays.
@pspeed said: Yeah, I mistyped.
re: your scene graph, so you only have like four objects in the root node or do you have 100s of objects with cull hint played with. What about when you batched?
From this point you may have to struggle on your own unless you can provide more info or make a simple test case illustrating the issue.
In my root node I only have my level node attached, then the lights and blocks and player attached to that level node. I have a few hundred blocks in a large level, so yes I suppose I do have a few hundred things attached to rootNode, if through level node. The blocks are on a BatchNode.
Here’s a case like you wanted:
It has the first tutorial level. That level has a ton of lights so it isn’t optomized at all. It runs at around 35 fps on my computer.
When saying you want more information what information do you want? I could supply you with the whole code but I highly doubt you want to sift through all that ;).
Ask any questions about it and I’ll answer, the help is really appreciated.
Edit: I just discovered that if I don’t set the resolution at all so that it’s default the fps rockets up to ~60 on that tutorial level. I originally set it to 1280x720. Interesting.
…lots of lights…?
How many lights?
The scene is rendered once for each light. 5 lights = render the scene 5 times.
Lots as in 9 of them. I didn’t expect any good performance, I was really just testing my game. When I get rid of the lights I go up by about 30-35 FPS. However they lights really make the game seem more immersive. I could just have the player light but that really decreases the visual quality.
@Slyth said: Lots as in 9 of them. I didn't expect any good performance, I was really just testing my game. When I get rid of the lights I go up by about 30-35 FPS. However they lights really make the game seem more immersive. I could just have the player light but that really decreases the visual quality.
Are all of the lights mobile or just the player lights?
You could bake stationary lights into the geometry, for example. Most voxel engines deal specifically with lights this way and just bake them into the geometry.
I’ve heard of baking but I’ve always thought that it was something you did in the modeler or something. Every light except the player light is static however I do intend to make a couple moving lights in the later levels. But that’s not important. I’ll go research baking them into the geometry right now, thanks! If I run into any confusion I’ll post.
Edit: I ran into confusion. :facepalm:
It seems like baking is only in the modeler. This doesn’t make my game very dynamic if I need to remove and place blocks at will. Is there actually a way to bake lights into the Geometry without modeling the scene in Blender? Otherwise I can’t use that work around I think.
Also I’ve decided to re-write the rendering piece of my game to do as you said. Maybe a bit overkill for a game like this but it’s more for learning than anything. Just to get it straight, please correct me if I’m wrong:
- Create the blocks, store them in a 3D array.
- After creation of level go through the array and for each block check if there blocks on any sides. If there isn’t a block on a certain side add a quad to the mesh.
- If there were any changes to the terrain set a boolean “needsUpdate” to true and in the update method if that is true then call something that rebuilds the mesh as described above.
If I understand this correctly this just creates one big Mesh and Geometry which would be an enormous improvement. For physics I would create a dynamic mesh body or whatever it’s called.
The only thing I could see that would hold me back from this approach would be that I don’t know how I would do collision for each block. I have a trampoline block which launches a player into the air on collision, so how would I, in the Player class that contains the collision method, detect which block I’m hitting so that I can call the onCollision() method for that block?
I guess turn the collision location into a grid cell location.
I actually did that previously and that produced inaccurate results. Since I fill everything that doesn’t have a block with this one instance of block air it was always colliding with that. I removed the collision detection from that and I started getting errors everywhere. I’ll just have to go into it before I can say anything though.
About the baking?
When you create the mesh, including a color attribute in the vertexes that represents the “lighting” you want.
I’d think that would create very blocky lighting, almost like minecraft. I’d have to do something along the lines of looping through all the blocks around a light during creation, and the closer it is, the more lit it is, and from what I know that’s exactly what minecraft does. I don’t want the diamond shaped lighting, I’m looking for lights that look real, so I think I’m going to just use less lights. No biggie really.
@Slyth said: I'd think that would create very blocky lighting, almost like minecraft. I'd have to do something along the lines of looping through all the blocks around a light during creation, and the closer it is, the more lit it is, and from what I know that's exactly what minecraft does. I don't want the diamond shaped lighting, I'm looking for lights that look real, so I think I'm going to just use less lights. No biggie really.
Minecraft with smooth lighting doesn’t have diamond shaped lighting… unless you mean how it propagates it. But how you get the lighting value for each vertex is up to you. Minecraft uses a cellular automata style approach. You could just as easily use some kind of ray tracing.
There may be some artifacts along the quad diagonal for very extreme light differences. I think it’s still better than rendering the scene multiple times but that’s just me I guess. If you don’t have very many blocks then you could also get rid of it by making your quads differently.
@pspeed, you don’t get it, the OP is so over powered that he will do alone with his strong arms something better than minecraft. After all, they are just normal humans, they are an organized team, with people with years of experience, and their game just exists for years.
No, they are just nothing in front of the op, he is so smart and intelligent that he will do something that will run faster and be nicer. He doesn’t want a blocky appearance like the one in minecraft, you know, it’s just because mojang don’t have taste for beautifull things that they did it this way. Yeah, they are so poor developpers that they never thought “he, what about a lighting system that looks like the one the real life ?”. No, only the op can find a so smart idea.
OP, i hope you’ll do a network game someday, so you can just teach to us how dumb was all the game devs before. They was dealing with some dumb things like lag and doing things so obviously stupid for you, like interpolation.
EDIT : maybe is sounds a bit bitter, but when i read things like “it will be <b>only</b> like minecraft” or equivalent things it makes me upset. Most of commercial games out there are piece of jewelry when you look at the code, as they overcome a lot of problems with very smart and complex solutions, that most of time people even don’t know the existence. For example look at this http://coitweb.uncc.edu/~krs/courses/5010/ged/lectures/cull_lod2.pdf
You can also think about textures baking, shaders etc.
So, before saying that a game is poorly designed in something, try to figure out why it was done this way in the first place.
I’m sorry if I sounded superior… I didn’t mean to I’m not quite sure why you thought I was. What I’m trying to say is that I didn’t want to implement their lighting scheme, but rather do something along the lines of what the jME pointlight is. I haven’t a doubt that the developers of minecraft were working with performance in mind and that they are much smarter developers than I am. I also never said that minecraft was poorly designed. So once again, excuse me…
Anyways, I’ve found a solution now and I’m working on redoing the rendering part of the game. Thanks to those of you that took the time out of their day to help me, it’s much appreciated
If you just want to see what per-vertex baked lighting might look like you can turn on vertex lighting in your materials. This is a ‘low quality’ option in the standard lighting material that on-the-fly computes the same lighting values it would use but only does it at the vertex and then interpolates. I put ‘low quality’ in quotes because sometimes it looks just fine.
Ah I tried that out and it does seem to lower the quality a bit but it’s fine honestly. I’ll take a look into implementing that after all!
Too be honest minecrafts performance is shit, mythruna runs way better in fps and micro lag terms btw.
@Empire Phoenix said: Too be honest minecrafts performance is shit, mythruna runs way better in fps and micro lag terms btw.
You are kind to say this but apparently it depends on the platform. Or it may just be that MC on older platforms disables a bunch of stuff automatically. Either way, I’ve taken it as something to watch that optimizations can have the opposite effect on some platforms.