#444
Posted 16 November 2015 - 04:24 PM
#445
Posted 16 November 2015 - 11:23 PM
SquidDev, on 16 November 2015 - 04:14 PM, said:
As I mentioned in the Silica Gitter chat, I think it should be quite playable.
Texture-wise, Minecraft textures actually don't look too bad with a palette of 16 colours. (Note: the screenshot below doesn't use the CC colours, but 16 selected colours to best match the textures).

Speed-wise, the rendering is running at 40 FPS (without blitting). Presuming you're using the implementation of blit I used, it is intentionally poorly written to make performance issues more noticeable in Silica and could be quicker.
However, we're not sure what Dan actually has in the GFX API for us to render directly to the screen, but I'm realllllllllllly hoping that it has a good way to send all the changed pixels in one function call. (Honestly, bliting for 200 lines takes quite a while.) demhydraz on the Gitter chat suggested a blit method that used a string, did the entire screen and ignored a certain character (e.g. spaces) for buffering. A multidimensional table would also work, but it'd be slower.
#446
Posted 17 November 2015 - 08:01 AM
oeed, on 16 November 2015 - 11:23 PM, said:
On the latest screenshot/GIF/whatever, I noticed a gpu.drawMap function, judging by the argument list looks something like gpu.drawMap(x, y, map, no clue...). It is also using gpu.setCol, which is either setColour or setColourPallet. If someone has the time, it might be worth going through the pacman video, and see if we can find more exact function signatures - probably not worth it though.
#447
Posted 17 November 2015 - 12:35 PM
SquidDev, on 16 November 2015 - 04:14 PM, said:

For reference, this is an 8x8x8 chunk of blocks being rendered - there are about 2600 polygons here which are being drawn in 0.025 seconds, and blitted in 0.038. There are some pretty serious bugs with this:
On a positive note, these textures were rendered with about 20 lines of code which I think is pretty cool, and shows how powerful code generation can be.
Lets be honest though, this isn't ever going to be playable (though it is not too bad running in Love).
Update:
Fixing the additional line bug makes the alpha-blending look much better (though it easy too see that I'm not sorting faces correctly (green is opaque).

for i=1, #world do
for pol, _ in pairs(world[i]) {
if pol.z>0 then
--Draw polygons
end
}
end
Edited by LeDark Lua, 17 November 2015 - 12:46 PM.
#448
Posted 17 November 2015 - 12:44 PM
SquidDev, on 16 November 2015 - 04:14 PM, said:
Are you using a Z-Buffer? I got some ideas on how to implement partly transparent polygons. (Transparency is not possible with standard Z-Buffers)
Also, there's another performance improvement I have, if you're not already using it: Since most polygons in the world space share some vectors, you can give vectors with exactly the same position an index, and apply the transformations for every index. This way you don't transform the same point more than one time.
Edited by ardera, 17 November 2015 - 12:46 PM.
#449
Posted 17 November 2015 - 01:15 PM
LeDark Lua, on 17 November 2015 - 12:35 PM, said:
for i=1, #world do
for pol, _ in pairs(world[i]) {
if pol.z>0 then
--Draw polygons
end
}
end
I do cull triangles that are outside the render region, but I was under the impression that the z coordinate was between -1 and 1 - though I might be mistaken - everything does break when z reaches 0. I'm kinda stuck on this, because if z > 0, then you are dividing the x and y coordinates by a negative number, so the image is going to flip. This doesn't matter if the entire polygon is outside, but if one point's z > 0 and the other points aren't, then everything blows up.
ardera, on 17 November 2015 - 12:44 PM, said:
ardera, on 17 November 2015 - 12:44 PM, said:
ardera, on 17 November 2015 - 12:44 PM, said:
Edited by SquidDev, 17 November 2015 - 01:20 PM.
#450
Posted 17 November 2015 - 01:35 PM
ardera, on 17 November 2015 - 12:44 PM, said:
#451
Posted 17 November 2015 - 01:47 PM
ardera, on 17 November 2015 - 01:35 PM, said:
Backface Culling is one of those things I need to implement - also want to look into implementing a stencil buffer, as well as controlling which buffers are written to - because then we can have Portal!
Edited by SquidDev, 17 November 2015 - 01:48 PM.
#452
Posted 17 November 2015 - 04:28 PM
SquidDev, on 17 November 2015 - 08:01 AM, said:
I've already covered some things that I saw in the pacman video here. gpu.drawMap() draws a tile map. The tiles are loaded from a simple .image file.
#453
Posted 18 November 2015 - 12:15 AM
#454
Posted 18 November 2015 - 09:30 AM
Creeper9207, on 18 November 2015 - 12:15 AM, said:
Actually that's a very good point... I presume the 2600 means that every block has 2 per face and 6 faces. Now, it probably doesn't matter for a demo, but you might want to look in to removing shared edges.
You probably know what it is, in fact you might've already mentioned it somewhere and I missed it, but this page explains it a bit. http://0fps.net/2012...minecraft-game/
Edited by oeed, 18 November 2015 - 09:32 AM.
#455
Posted 18 November 2015 - 12:37 PM
oeed, on 18 November 2015 - 09:30 AM, said:
Index buffers could help cut down the amount of vertices. Though, I'm not sure how that would improve performance (if at all).
#456
Posted 18 November 2015 - 01:56 PM
oeed, on 18 November 2015 - 09:30 AM, said:
You probably know what it is, in fact you might've already mentioned it somewhere and I missed it, but this page explains it a bit. http://0fps.net/2012...minecraft-game/
I already cull inside faces. I originally implemented "the greedy method" as mentioned in 0fps, and I guess I could look into poly2tri as mentioned here. One thing I need to think about though is how to handle textures - otherwise textures will be stretched over the polygon.
Lignum, on 18 November 2015 - 12:37 PM, said:
As mentioned in this post, I already do do this. The matrix transformations are pretty minimal, but I guess it adds up.
My biggest problem at the moment is culling near the z-plane - I still haven't made any progress on it
Edited by SquidDev, 18 November 2015 - 01:59 PM.
#457
Posted 18 November 2015 - 01:57 PM
Lignum, on 18 November 2015 - 12:37 PM, said:
oeed, on 18 November 2015 - 09:30 AM, said:
Index buffers could help cut down the amount of vertices. Though, I'm not sure how that would improve performance (if at all).
You have to transform less coordinates.
#458
Posted 19 November 2015 - 07:51 AM
#459
Posted 19 November 2015 - 08:16 AM
Edited by oeed, 19 November 2015 - 12:47 PM.
#460
#461
Posted 19 November 2015 - 08:48 AM
Wait_, on 19 November 2015 - 08:16 AM, said:
Actually that's a good point, surprised we overlooked that. It's hard to tell whether it is dynamic resolution or it just scales as both his screen (a MacBook screen) and the CraftOS 2.0 screen both have a 1.6:1 ratio.
#463
Posted 19 November 2015 - 02:20 PM
Edited by apemanzilla, 19 November 2015 - 02:20 PM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











