GRP2 discussion

Programming topics can be found here.
bikker
Posts: 67
Joined: Fri Sep 27, 2013 12:40 pm

Re: GRP2 discussion

Post by bikker » Wed Dec 25, 2013 4:11 pm

I agree to some extend. Writing a program that contains a bug should not result in correct program behavior. On the other hand, once your game has been released, this would actually be beneficial. :)

User avatar
122675
Posts: 25
Joined: Mon Sep 30, 2013 9:48 am
Contact:

Re: GRP2 discussion

Post by 122675 » Thu Dec 26, 2013 7:19 pm

Not a lot of rasterizer-related posts here anymore, would love to see some images of what everyone is doing!
I'm currently remaking Minecraft, which is of course not a classic 2D game but it just seemed like a lot of fun :P
Image
The landscape is completely generated. I use several 'octaves' of Simplex Noise to generate the heights of the terrain at a certain position and then use the height of a block to determine its type. The block data is then used to build an efficient mesh that has no interior faces, which you would have a lot of if you draw a complete cube per block.
Unfortunately we did not learn how to do proper shadows so I had to fake them. For each triangle of the mesh I check the neighboring blocks and depending on those I change its texture to a darker texture. This means my light is a directional one that is limited to 45 or 90 degree angles on each axis (otherwise the triangles can't form the shapes). However it still looks quite nice:
Image
I hope to see some more graphics posts here. Oh, and happy holidays! :D
Tom Veltmeijer

110177
Posts: 6
Joined: Sun Sep 29, 2013 4:58 pm

Re: GRP2 discussion

Post by 110177 » Thu Dec 26, 2013 8:46 pm

Shadows are usually done in OpenGL by using framebuffers. Drawing the depth of the scene per pixel from the viewpoint of the light, then checking the depth at the point of the framebuffer the current pixel would be at (if any) to see if it is visible.

Applying this to a software rasterizer is possible. Just do the same thing: Render from a different viewpoint onto a texture instead of the screen, and sample from there.

Class material from GRP4 on Shadow Mapping: Projected Shadow Mapping with Cg and OpenGL | 3D Game Engine Programming
Rick van Miltenburg
3GA-1PR

bikker
Posts: 67
Joined: Fri Sep 27, 2013 12:40 pm

Re: GRP2 discussion

Post by bikker » Mon Dec 30, 2013 9:50 pm

Sweet Tom! If you have an update, post some more images!
By the way, a while ago I dabbled with Minecraft worlds as well, and I found that you can optimize the mesh considerably if you join coplanar polygons with the same materials. You can look for long strips; my algo checked for very long strips first and then gradually decreased the 'search size' until only quads were left. In practice this reduced overall polygon count to less than 20%. For a software rasterizer, this might help performance significantly.

I've been doing some coding as well, and I stayed far away from ray tracing (for a change). Attached screenshot shows a procedurally generated world, using 12 octaves of Perlin noise, with some additional twists. You can zoom in on the landscape 2x, 4x, 8x and 16x, and in all cases, you get full detail (hence the 12 octaves). Landscape data is stored in 256x256 pixel tiles, and for the zoom levels, also in 128x128 tiles and so on, to reduce computation time when zoomed out.

I am not yet sure what I will do with it, maybe some biosphere simulator, with a vegetation simulation and flocks of animals (carnivores, herbivores). We'll see. Procedural is fun. :)

2D is on purpose btw. Landscape is somewhat based (by now: inspired by) this one: https://www.shadertoy.com/view/4slGD4 . Which is a totally amazing shader.
Attachments
world.jpg
world.jpg (169.67 KiB) Viewed 6412 times

User avatar
122675
Posts: 25
Joined: Mon Sep 30, 2013 9:48 am
Contact:

Re: GRP2 discussion

Post by 122675 » Tue Dec 31, 2013 5:40 pm

I have seen that guy's YouTube videos before and they are indeed amazing. Your terrain looks really good as well, do you have any sources for terrain generation or is it just a lot of trial and error?
As for the mesh optimization, I now have an infinite terrain, so when the player gets to the edge of the map I have to generate meshes at runtime. This is kind of slow right now, even when using a memory pool, so I don't think adding extra checks in there will be beneficial (unless I multithread it, but the code is already quite complicated so I'm not going to).
I didn't do much visually since last time I posted because most time was spent on creating the infinite terrain. I did however add a few small things like trees and snowy mountains:
Image
Image
What I mostly want to focus on now is the terrain generation because it looks quite boring at the moment. After that I might want to add placement and removal of blocks :P
Tom Veltmeijer

100430
Posts: 3
Joined: Sun Sep 29, 2013 4:19 pm

Re: GRP2 discussion

Post by 100430 » Tue Dec 31, 2013 10:22 pm

Happy to say that I am finally feature complete too. Was stuck on a silly mistake for 3 days (yay me).
Complete with projection matrices and frustum clipping. Time to optimize the hell out of this.

Have some Wipeout.

Image

120677
Posts: 2
Joined: Fri Jan 03, 2014 10:58 pm

Re: GRP2 discussion

Post by 120677 » Fri Jan 03, 2014 11:03 pm

Managed to implement some old project into the rasterizer lol :
Image

The right one is my very first project ever (Galaxians), the left one is my gauntlet assignment, and the middle one is my Raytracer.
You can fully complete the games and you can move around in the Raytracer.
;)

bikker
Posts: 67
Joined: Fri Sep 27, 2013 12:40 pm

Re: GRP2 discussion

Post by bikker » Wed Jan 08, 2014 6:06 pm

Final slides are online.
Mathijs, why didn't you demo?

Link to Ingo Wald's animation repository:
http://www.sci.utah.edu/~wald/animrep/s_en_index.html

120677
Posts: 2
Joined: Fri Jan 03, 2014 10:58 pm

Re: GRP2 discussion

Post by 120677 » Thu Jan 09, 2014 3:38 am

I would have, but sadly, I became ill today and missed the lecture

User avatar
110103
Posts: 1
Joined: Fri Jan 10, 2014 5:58 pm

Re: GRP2 discussion

Post by 110103 » Fri Jan 10, 2014 6:08 pm

Hey Everyone,

As you are all finalizing the software rasterizer right now I might have a nice bonus for you guys to add!
The always excellent posts of Fabian Giesen share a view on texture tiling and swizzling. I am sure that Jacco has explained how this goes but its still a nice read. Also he wrote some sample code that might help you all with an implementation!

http://fgiesen.wordpress.com/2011/01/17 ... swizzling/
https://github.com/rygorous/vivante_swizzle

Also after seeing some screenshots and hearing about some of the coding from some of the people making their software rasterizers, it got me excited again! :)

Good luck with the finalization,

Cheers,
Juul Joosten 110103
I like to write images and architecture.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest