I haven't done any serious testing but I'm pretty sure it has no discernible performance impact. It's probably fine to slip it into the model:draw function if you want to implement some sort of model:setCullMode() function.Jasoco wrote: ↑Tue Jan 18, 2022 12:44 pmWhy didn't I think of that? Does it have any sort of impact on performance?Hydrogen Maniac wrote: ↑Mon Jan 17, 2022 11:36 pm You can simply call love.graphics.setMeshCullMode between drawing the models.Code: Select all
love.graphics.setMeshCullMode("back") model:draw() --drawn with back culling love.graphics.setMeshCullMode("front") model2:draw() --drawn with front culling
Groverburger's 3D Engine (g3d) v1.5.2 Release
- Hydrogen Maniac
- Citizen
- Posts: 80
- Joined: Sat Dec 19, 2015 9:59 pm
Re: Groverburger's 3D Engine (g3d) v1.5.1 Release
I'm way too sober for this...
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Groverburger's 3D Engine (g3d) v1.5.1 Release
Doesn't seem to have any performance hit. I can't see why it would. That's cool. I can just set the proper mode before drawing each model based on whether they should have a back side or not. Better than making the same polygons twice. Though that doesn't seem to have much impact either. This is just easier. lolHydrogen Maniac wrote: ↑Tue Jan 18, 2022 4:38 pm I haven't done any serious testing but I'm pretty sure it has no discernible performance impact. It's probably fine to slip it into the model:draw function if you want to implement some sort of model:setCullMode() function.
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Groverburger's 3D Engine (g3d) v1.5.1 Release
Is it possible to have the triangles be a single color or utilize .mtl files instead of a texture? Would that be possible to implement or should I just stick to using single color textures if I need to have flat shaded polygons?
Also is it possible to easily convert Y-up oriented .obj data to Z-up orientations? I've noticed most of the .obj files I find online use Y-up but g3d changed to Z-up a while ago so they end up importing lying down instead. Is it as easy as just switching the Y and Z around when importing? Surely the UV would have to be manipulated as well if so. I just wouldn't know how to go about it myself.
Also is it possible to easily convert Y-up oriented .obj data to Z-up orientations? I've noticed most of the .obj files I find online use Y-up but g3d changed to Z-up a while ago so they end up importing lying down instead. Is it as easy as just switching the Y and Z around when importing? Surely the UV would have to be manipulated as well if so. I just wouldn't know how to go about it myself.
- EngineerSmith
- Prole
- Posts: 38
- Joined: Thu Dec 02, 2021 11:38 am
- Contact:
Re: Groverburger's 3D Engine (g3d) v1.5.1 Release
You can easily switch to z up by importing your model into blender, and then when exporting an option for z-up will appear (you can also triangulate faces as an option if they're not yet).
MTL files can be supported - but it will means g3d will have to shift it's idea of what a model is. A model would have multiple meshes as OBJ+MTL can define multiple materials for multiple 'objects' within the file. This means g3d would have to implement a material system to support it - when g3d aim is meant to keep simple so people can easily customize it with little overhead. You could fork it and add such a system in if you want - MTL files are human readable similar to OBJ and you could make the addition in a couple days of works.
Edit: g3d also supports colours within meshes, but not via the obj reader. `VertexColor` can be found as the 4th attribute to the vertex layout (9th index of the vertex (lua arrays)).
MTL files can be supported - but it will means g3d will have to shift it's idea of what a model is. A model would have multiple meshes as OBJ+MTL can define multiple materials for multiple 'objects' within the file. This means g3d would have to implement a material system to support it - when g3d aim is meant to keep simple so people can easily customize it with little overhead. You could fork it and add such a system in if you want - MTL files are human readable similar to OBJ and you could make the addition in a couple days of works.
Edit: g3d also supports colours within meshes, but not via the obj reader. `VertexColor` can be found as the 4th attribute to the vertex layout (9th index of the vertex (lua arrays)).
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Groverburger's 3D Engine (g3d) v1.5.1 Release
I've done this before I was just wondering if it could just be put into the library as an option. I could probably code my own if I really need it. Probably won't in the end though as I'd just be making my own models eventually and would just export them the g3d way.EngineerSmith wrote: ↑Fri Jan 28, 2022 9:42 am You can easily switch to z up by importing your model into blender, and then when exporting an option for z-up will appear (you can also triangulate faces as an option if they're not yet).
You'd just load the .mtl file instead of a .png file and it would parse the .mtl file instead. (I only want the face color definitions, not trying to replicate stuff like shiny metal or rough brick textures or whatever) I could probably try and figure it out myself. It's a lot of data to parse but it's pretty much done the same way g3d parses the .obj file itself. It's just having g3d display the triangles as the correct color I wouldn't know where to start with. So let me go look. Maybe I can hack support in myself.EngineerSmith wrote: ↑Fri Jan 28, 2022 9:42 am MTL files can be supported - but it will means g3d will have to shift it's idea of what a model is. A model would have multiple meshes as OBJ+MTL can define multiple materials for multiple 'objects' within the file. This means g3d would have to implement a material system to support it - when g3d aim is meant to keep simple so people can easily customize it with little overhead. You could fork it and add such a system in if you want - MTL files are human readable similar to OBJ and you could make the addition in a couple days of works.
Edit: g3d also supports colours within meshes, but not via the obj reader. `VertexColor` can be found as the 4th attribute to the vertex layout (9th index of the vertex (lua arrays)).
I dunno, maybe it's more complicated. I don't know much about 3D rendering programs. If I did I'd be using Blender by now. lol
I just wanted to implement this because I found some really good royalty free low poly objects, namely a whole bunch of trees and houses, that I wanted to use as placeholders but they all use face colors instead of textures. And I wouldn't know how to change them all to have a texture instead, even if it's a flat color texture. I also like the aesthetic of just flat shaded polygons.
- EngineerSmith
- Prole
- Posts: 38
- Joined: Thu Dec 02, 2021 11:38 am
- Contact:
Re: Groverburger's 3D Engine (g3d) v1.5.1 Release
Honestly, if you want a really simple system. First you read the MTL file and grab the colours for the different materials definitions, then as you parse the OBJ you switch which material you use when the command appears (I think I remember it being usemtl <material name> or something) and you then just use that materials colour within each vertex. Then you don't need to have separate meshes for each object - this won't work if you want different textures however - unless they're all on the same texture.Jasoco wrote: ↑Fri Jan 28, 2022 4:04 pm You'd just load the .mtl file instead of a .png file and it would parse the .mtl file instead. (I only want the face color definitions, not trying to replicate stuff like shiny metal or rough brick textures or whatever) I could probably try and figure it out myself.
The wiki covers all what the readable files mean https://en.wikipedia.org/wiki/Wavefront ... te_library you probably want to focus on the key `Kd` in each material for the diffuse colour, and then the others if you want a more interesting lighting.
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Groverburger's 3D Engine (g3d) v1.5.1 Release
I'll just forget about that whole thing. If I want a flat shade I'll just make my models with single color textures. lol
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Groverburger's 3D Engine (g3d) v1.5.1 Release
Question though: Is there a way to tilt the camera around the third axis? You can spin it around the Z (Turning) axis. Tilt it on the X (Looking up and down) axis. But how if possible, do you tilt it on the Y (Forward) axis? Is this possible officially? Or can it be easily implemented? I guess it would also be referred to as rolling the camera.
- groverburger
- Prole
- Posts: 49
- Joined: Tue Oct 30, 2018 9:27 pm
Re: Groverburger's 3D Engine (g3d) v1.5.1 Release
Yep, the easiest way to achieve this is to change the camera's up vector, and make it point up and slightly to whatever direction you want to tilt.Jasoco wrote: ↑Sun Apr 03, 2022 9:34 pm Question though: Is there a way to tilt the camera around the third axis? You can spin it around the Z (Turning) axis. Tilt it on the X (Looking up and down) axis. But how if possible, do you tilt it on the Y (Forward) axis? Is this possible officially? Or can it be easily implemented? I guess it would also be referred to as rolling the camera.
Something like:
Code: Select all
g3d.camera.up = {some vector here}
g3d.camera.updateViewMatrix()
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Groverburger's 3D Engine (g3d) v1.5.1 Release
Interesting but it seems to rotate the world itself instead of just the camera. In other words, if I'm looking forward and I change say the Y value, it'll look right until I turn my head at which point I realize it's changing the world itself instead of just rolling the camera.groverburger wrote: ↑Mon Apr 04, 2022 6:57 pm Yep, the easiest way to achieve this is to change the camera's up vector, and make it point up and slightly to whatever direction you want to tilt.
Something like:Code: Select all
g3d.camera.up = {some vector here} g3d.camera.updateViewMatrix()
I tried to just use Löve's translation stuff like push, rotate, translate, pop to just rotate the image itself but of course since g3d is all shader based it just ignores all that. lol
Who is online
Users browsing this forum: Bing [Bot] and 0 guests