## Oysi's 3D Rendering & Physics Engine

Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

### Re: Oysi's 3D Rendering & Physics Engine

Awesome sauce, don't 3D engines use filters on meshes to smooth polygons and to make objects more realistic ? (like this)
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping

Oysi
Prole
Posts: 48
Joined: Fri May 02, 2014 11:18 pm
Location: Earth

### Re: Oysi's 3D Rendering & Physics Engine

Ranguna259 wrote:Awesome sauce, don't 3D engines use filters on meshes to smooth polygons and to make objects more realistic ? (like this)
They do indeed. It works by using a different normal for every vertex of the polygon, and then have it interpolated per pixel. I did actually do this, right after I made the texturing (very early on in this thread), as they both work off the same concept. You can see it here. You will also be able to see it my newest video:

TERRAIN!

LiquidDandruff
Prole
Posts: 18
Joined: Fri Dec 16, 2011 11:29 pm

### Re: Oysi's 3D Rendering & Physics Engine

I've just read the entire thread. This is amazing stuff, Oysi! I can't wait for your tutorials; you really are a god!

Scratchthatguys
Prole
Posts: 8
Joined: Thu Jun 12, 2014 10:49 pm

### Re: Oysi's 3D Rendering & Physics Engine

LiquidDandruff wrote:I've just read the entire thread. This is amazing stuff, Oysi! I can't wait for your tutorials; you really are a god!

Code: Select all

function love.load()
now = os.time
videos = {}
people = {}
people["god"] = oysi93
end
function love.update(dt)
if os.time() >= now then
videos[#videos + 1] = video.new()
love.event.quit()
end
end


Oysi
Prole
Posts: 48
Joined: Fri May 02, 2014 11:18 pm
Location: Earth

### Re: Oysi's 3D Rendering & Physics Engine

Haha.

Here's me having fun with my "engine", showing some of the stuff it's capable of:

I almost feel bad doing this, seeing as I haven't uploaded the thing.
almost =P

Oysi
Prole
Posts: 48
Joined: Fri May 02, 2014 11:18 pm
Location: Earth

### Re: Oysi's 3D Rendering & Physics Engine

So with the previous optimizations I discovered, I've been rewriting my engine. But I got sort of stuck when I came to the shaders, because there are so many different ways of doing it. At first I used different shaders for different effects. One for texture mapping, one for texture mapping with normal mapping, one for texture mapping with normal mapping with some other effect, and so on. It was very tedious to have more than one, mainly because of all the extra code in each shader that is necessary to make it work. After that I swapped to a more unified system, where instead of using different shaders, I just put everything into one shader, but I could enable and disable features as I wanted. This is of course very nice for demonstration purposes, because I can change stuff at runtime with a simple function call. But the problem with this is that even though I turned things off, it would still send all the information, so turning everything off would change the output image, but not the performance.

Now I've sort of gone back to my first system, but I've changed it around a bit. Instead of adding in all that extra code, I created an include preprocessor directive. Currently it only works with 3 different things, GL_UNIFORMS, GL_LIB, and GL_MAIN, but I could of course make it work with filenames and such as well. Uniforms is the one with the uniforms (duh), sent from the lua code, having the projection information and such. Lib has a library of handy functions to make life easier, including the 'uv' function you see. And Main does all the main things, reverse projection, raycasting, uv mapping, all the good stuff to get the proper information you need. With all of this, I can create easy shaders:

That shader effectively takes in the 3 vertex positions, 3 vertex colors, interpolates the color, and scales it by the depth to the pixel, giving this result:

Here's a different shader, which also does texture mapping along with the per vertex color:

And its result: (I pushed the camera further ahead, and reduced the intensity on the depth for a better image)

Here is one last shader, where I took out the per vertex color, and added per vertex texture. =O

And the result: (I left only one cube alive, and I rearranged the vertices for a better image)

What do you guys think?

HugoBDesigner
Party member
Posts: 403
Joined: Mon Feb 24, 2014 6:54 pm
Location: Above the Pocket Dimension
Contact:

### Re: Oysi's 3D Rendering & Physics Engine

It looks really, really good, Oysi. It's smaller, so it'll be faster, and it's easier for you to add in new features. Good work! Your engine is the best 3D engine after Löve that I've seen so far!
HugoBDesigner - my Blog

Oysi
Prole
Posts: 48
Joined: Fri May 02, 2014 11:18 pm
Location: Earth

### Re: Oysi's 3D Rendering & Physics Engine

Hi again, I have a new update. A haxy haxy sphere thingy (they're not actually real spheres, but then again, they behave just like normal spheres, so it really comes down to how you would define a real sphere, and whether you are philosophical enough to discuss this at length)...

Which is done by this neat little shader:

It's incredibly fast, and I can't wait to implement optimized physics for spheres, so I can see how many of them I can have at once. =o

Although I am in the process of rewriting the whole thing, again. More to come later. =)

Positive07
Party member
Posts: 1006
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

### Re: Oysi's 3D Rendering & Physics Engine

Oysi I may be dumb of course your 3D is amazing but I'm far more interested in that console of yours... it's awesome! can you post it or give me many hints on the workings of it?
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(Github.com/Positive07)

veethree
Inner party member
Posts: 820
Joined: Sat Dec 10, 2011 7:18 pm

### Re: Oysi's 3D Rendering & Physics Engine

Positive07 wrote:Oysi I may be dumb of course your 3D is amazing but I'm far more interested in that console of yours... it's awesome! can you post it or give me many hints on the workings of it?
As far as i can tell it uses loadstring to run lua code. I've made one of those myself, There's a version of it hidden (in plain sight) in the source of my calculator if you want to check it out. If i remember right that version of it is completely self contained, so you can drop it into any project and it'll work.

### Who is online

Users browsing this forum: No registered users and 20 guests