## Groverburger's 3D Engine (G3D) New and Improved!

groverburger
Prole
Posts: 16
Joined: Tue Oct 30, 2018 9:27 pm

### Groverburger's 3D Engine (G3D) New and Improved!

groverburger's 3D Engine (g3d) is my take on simplifying love 11's new 3d capabilities into a ready-to-use library for simple 3d games.

Get the latest version of g3d and a simple tutorial on the Github page here:
https://github.com/groverburger/g3d

g3d's demo in action:

The entire code for the demo is only 30 lines:

Code: Select all

-- written by groverbuger for g3d
-- august 2020

require "g3d"

Earth = Model:new("assets/sphere.obj", "assets/earth.png", {0,0,4}, nil, {-1,1,1})
Moon = Model:new("assets/sphere.obj", "assets/moon.png", {5,0,4}, nil, {-0.5,0.5,0.5})
Background = Model:new("assets/soccerball.obj", "assets/skybox.png", {0,0,0}, nil, {500,500,500})
end

function love.mousemoved(x,y, dx,dy)
FirstPersonCameraLook(dx,dy)
end

function love.update(dt)
Timer = Timer and Timer + dt or 0
Moon:setTranslation(math.cos(Timer)*5, 0, math.sin(Timer)*5 +4)
Moon:setRotation(0,-1*Timer,0)
FirstPersonCameraMovement(dt)
end

function love.draw()
Earth:draw()
Moon:draw()
love.graphics.setWireframe(true)
Background:draw()
love.graphics.setWireframe(false)
end

Features:
- 3D Model rendering
- Basic first person movement and camera controls
- Perspective and orthographic projections
- Functions for simple collision handling
- Simple, commented, and organized

Installation:

Here's an example of what can be done with this engine.
This is a Minecraft clone I've been working on. I abstracted the engine I used for this project and that is what became G3D.
https://github.com/groverburger/lovecraft

Feedback and suggestions are greatly appreciated!
g3d is offered under the MIT license. Check the LICENSE file on Github for more details.
Last edited by groverburger on Fri Sep 11, 2020 6:14 am, edited 7 times in total.

St. Cosmo
Prole
Posts: 8
Joined: Wed Nov 07, 2018 6:53 pm

### Re: groverburger's Super Simple 3D Engine

Impressive work m8

pgimeno
Party member
Posts: 2305
Joined: Sun Oct 18, 2015 2:58 pm

### Re: groverburger's Super Simple 3D Engine

Wow and wow. That's a very impressive work. Map generator including strata and trees, collision handling, very decent lighting with light propagation. Great job.

The FOV is a bit wide, which can cause a bit of dizziness. But that's an easy adjustment

The name was already used for a 2D game (also here but that's just an early test). As hinted in that thread, that name suggests darker contents, which is a bit of a problem.

Another problem is the lack of any license text and copyright statement in the repository. Legal stuff is damn boring to handle, but needs to be sorted out correctly if you want it to be of any use to others. Also, are the assets yours? Are they under the same license? Unless they are yours or public domain, that is a problem as well, because there are no credits or license statement for them in the repo. In case they are not free, note there are free assets in the Minetest repo (CC BY-SA, see license for details).

groverburger
Prole
Posts: 16
Joined: Tue Oct 30, 2018 9:27 pm

### Re: groverburger's Super Simple 3D Engine

St. Cosmo wrote:
Mon Feb 11, 2019 2:59 pm
Impressive work m8
pgimeno wrote:
Mon Feb 11, 2019 6:54 pm
Wow and wow. That's a very impressive work. Map generator including strata and trees, collision handling, very decent lighting with light propagation. Great job.

The FOV is a bit wide, which can cause a bit of dizziness. But that's an easy adjustment

The name was already used for a 2D game (also here but that's just an early test). As hinted in that thread, that name suggests darker contents, which is a bit of a problem.

Another problem is the lack of any license text and copyright statement in the repository. Legal stuff is damn boring to handle, but needs to be sorted out correctly if you want it to be of any use to others. Also, are the assets yours? Are they under the same license? Unless they are yours or public domain, that is a problem as well, because there are no credits or license statement for them in the repo. In case they are not free, note there are free assets in the Minetest repo (CC BY-SA, see license for details).
Thanks for the compliments and feedback!
I was sure the name Lovecraft was already taken. If that causes too many problems, I may change it in the future.

I'll be upfront that I currently know very little about legal stuff and licensing or how to apply it to my creations. I want SS3D to be free for anyone to use in their creations and even sell without problems. The engine.lua file was created entirely by me so that shouldn't be too much of an issue.

In Lovecraft, the things I used but didn't create myself are all the textures and gui sprites (all stolen from Minecraft directly), and CPML. I should give credit to CPML and I could change the textures to Minetest textures as you said, but Lovecraft is intended to be an open-source hobby project so I don't think Microsoft would cause me any problems regardless.
I'll do some research on the topic. Thanks again for your feedback.

pgimeno
Party member
Posts: 2305
Joined: Sun Oct 18, 2015 2:58 pm

### Re: groverburger's Super Simple 3D Engine

It's not really hard, a quick way is to just include a LICENSE.md or .txt in the repository with the copyright and the license text, and mention in every file that the license can be found there.

In the CPML directory you already include one: https://github.com/groverburger/lovecra ... LICENSE.md but that's the CPML license only, obviously. You can use it as a guide, but note that the authors have forgotten to comply with the BSD 2-clause license: https://github.com/Nition/UnityOctree/b ... er/LICENCE which also requires the license text to be reproduced. I've filed an issue about that in the CPML tracker.

drikdrok
Prole
Posts: 36
Joined: Sun Mar 15, 2015 9:53 am
Contact:

### Re: groverburger's Super Simple 3D Engine

Awesome stuff! This will be my goto library if I ever want to make a 3D game with Löve!

Can't wait for lighting and .obj import. Perhaps you could add collision handling too!

groverburger
Prole
Posts: 16
Joined: Tue Oct 30, 2018 9:27 pm

### Re: groverburger's Super Simple 3D Engine

pgimeno wrote:
Tue Feb 12, 2019 12:44 am
It's not really hard, a quick way is to just include a LICENSE.md or .txt in the repository with the copyright and the license text, and mention in every file that the license can be found there.

In the CPML directory you already include one: https://github.com/groverburger/lovecra ... LICENSE.md but that's the CPML license only, obviously. You can use it as a guide, but note that the authors have forgotten to comply with the BSD 2-clause license: https://github.com/Nition/UnityOctree/b ... er/LICENCE which also requires the license text to be reproduced. I've filed an issue about that in the CPML tracker.
Thanks for the support! I'll make sure to do that when I migrate SS3D to github.
drikdrok wrote:
Fri Feb 15, 2019 9:09 pm
Awesome stuff! This will be my goto library if I ever want to make a 3D game with Löve!

Can't wait for lighting and .obj import. Perhaps you could add collision handling too!
Thanks for the compliments and feedback! I have some simple diffuse lighting working but it's not polished yet, it should be making its way into SS3D sometime soon. CPML has some really handy 3d line to triangle intersection functions that work well for collisions. I'll put collision handling on the todo list, but in the meantime here's a simple collision function I was testing using CPML.

The ray.direction represents where the object will be next frame, and the function tests if the line from where the object is now to where it is next frame intersects with any model in the CollisionList. It may still have some bugs.

Code: Select all

-- check for collisions, put add models you want to have collisions to the CollisionList
for i=1, #CollisionList do
local pos = cpml.vec3.new(self.x,self.y,self.z)
local ray = {}
ray.position = cpml.vec3.new(0,0,0)
ray.direction = cpml.vec3.new(0,self.ySpeed,0)

local triangle = {}
triangle[1] = cpml.vec3.new(CollisionList[i].verts[1]) - pos
triangle[2] = cpml.vec3.new(CollisionList[i].verts[2]) - pos
triangle[3] = cpml.vec3.new(CollisionList[i].verts[3]) - pos

local intersection, distance = cpml.intersect.ray_triangle(ray, triangle)

if intersection ~= false then
print(intersection)

if intersection:len() <= ray.direction:len() then
-- COLLISION DETECTED!
end
end
end


monolifed
Party member
Posts: 130
Joined: Sat Feb 06, 2016 9:42 pm

### Re: groverburger's Super Simple 3D Engine

You can use this free texture pack:
https://opengameart.org/node/91360

groverburger
Prole
Posts: 16
Joined: Tue Oct 30, 2018 9:27 pm

### Re: Groverburger's Super Simple 3D Engine - v1.2

Proper licensing added to the repositories. Lovecraft and SS3D are both now under the MIT license.

skapunch
Prole
Posts: 1
Joined: Tue May 14, 2019 11:43 pm

### Re: Groverburger's Super Simple 3D Engine - v1.2

Hello there! I am a newbie.Thank you for sharing the 3D Engine.
i run the demo on my laptop (Onboard Intel HD Graphics 3000) and here are the results ( the 2nd pictures in which i commented out the FloorModel).At first i thought it was because of the driver and the dependencies (i tried running the demo on my desktop, which also uses an onboard and it works) so I tried updating my laptop's driver to the lastest and installing all the VC redists, Directx, etc. but the result is still the same. Any thought on this issue?

### Who is online

Users browsing this forum: No registered users and 13 guests