[/quote]
What kind of animations? Texture animation or model animation? For the first one, you can update the texture of a model every frame to change its texture for animations. For the second, look into the Hoarder's Horrible House of Stuff project. I believe it uses bones in its models to animate the main character. If I'm not mistaken.
[/quote]
oh I've already got Billboarding to work and also model animations, it was through Inter Quake Models, just needed to add that plugin to Blender, export then load them in LOVE, it wasn't that bad, just a bit confusing at first. Thanks so much for the reply BTW!
Groverburger's 3D Engine (g3d) v1.5.2 Release
Re: Groverburger's 3D Engine (g3d) v1.5.2 Release
Hello!
Just start playing around with g3d trying to make a simple voxel game, i have a question about models: do i need to load a .obj file or is possible to render basic shapes (like a cube) via pure code?
I have plans to create a text-based format for models (like Minecraft does using .json-like format) and i dont want to use .obj at all.
Just start playing around with g3d trying to make a simple voxel game, i have a question about models: do i need to load a .obj file or is possible to render basic shapes (like a cube) via pure code?
I have plans to create a text-based format for models (like Minecraft does using .json-like format) and i dont want to use .obj at all.
Re: Groverburger's 3D Engine (g3d) v1.5.2 Release
groverburger has made a basic voxel game here, you can check the way chunks are meshed here
https://github.com/groverburger/g3d_vox ... remesh.lua
and I think (not a real user of g3d though) you can either load obj files or feed the data directly, at least that's what the docs are saying here:
https://github.com/groverburger/g3d/wik ... tion-scale
https://github.com/groverburger/g3d_vox ... remesh.lua
and I think (not a real user of g3d though) you can either load obj files or feed the data directly, at least that's what the docs are saying here:
https://github.com/groverburger/g3d/wik ... tion-scale
Re: Groverburger's 3D Engine (g3d) v1.5.2 Release
Thanks for the tips.Nikki wrote: ↑Fri Jan 13, 2023 2:00 pm groverburger has made a basic voxel game here, you can check the way chunks are meshed here
https://github.com/groverburger/g3d_vox ... remesh.lua
and I think (not a real user of g3d though) you can either load obj files or feed the data directly, at least that's what the docs are saying here:
https://github.com/groverburger/g3d/wik ... tion-scale
I actually checked the code from g3d_voxel, but i find it too much "complex" against my current understanding of the platform to extract meaningful information from it; i still in the step of trying to draw individual shapes on the screen, then slowly proceed to code the chunk format and so on. So, i really want to see, like a individual example of how it works (eg. model = g3d.newModel(<stuff to render a cube using pure text and not .objs>, texture, translation, rotation, scale);).
The reason i'm reluctant to use .obj format for the models is because in long-term i want to use a way similar to how Minecraft store its models (JSON), so that's why i refrain to rely on .obj at this height of my learning; i fear i will become too dependant of .objs that later when i will start ditching it altogether in favour of .json models i will really struggle to remake the entire rendering code.
- Hydrogen Maniac
- Citizen
- Posts: 79
- Joined: Sat Dec 19, 2015 9:59 pm
Re: Groverburger's 3D Engine (g3d) v1.5.2 Release
Building a model using code is pretty straight forward. The below code creates a model of a plane.
Code: Select all
local verts = {
{0,1,0, 0,0},
{0,0,0, 0,1},
{1,1,0, 1,0},
{0,0,0, 0,1},
{1,0,0, 1,1},
{1,1,0, 1,0},
}
model = g3d.newModel(verts, "pathtotexture.png")
Note that the model might appear flipped or at an angle depending on what g3d.camera.up is set to and that the models' normals are determined by the order of the vertices.
I'm way too sober for this...
Re: Groverburger's 3D Engine (g3d) v1.5.2 Release
Is there a way to add something like a light point so the faces of rendered models would not look so flat on screen?
Re: Groverburger's 3D Engine (g3d) v1.5.2 Release
Interesting. How could i make a cube model in that way?Hydrogen Maniac wrote: ↑Mon Jan 16, 2023 2:18 pmBuilding a model using code is pretty straight forward. The below code creates a model of a plane.
Each vertex is composed like this: {x,y,z, u,v} and three vertices in a row creates a triangle.Code: Select all
local verts = { {0,1,0, 0,0}, {0,0,0, 0,1}, {1,1,0, 1,0}, {0,0,0, 0,1}, {1,0,0, 1,1}, {1,1,0, 1,0}, } model = g3d.newModel(verts, "pathtotexture.png")
Note that the model might appear flipped or at an angle depending on what g3d.camera.up is set to and that the models' normals are determined by the order of the vertices.
Also, i think i can plug in a json library to load and save the models. That would be very similar to how Minecraft (and maybe Minetest, idk) store the models. Maybe in the future i can also try to implement a way to load Optifine's CEM models, that are JSON files that describe more details for entity animations.
- Hydrogen Maniac
- Citizen
- Posts: 79
- Joined: Sat Dec 19, 2015 9:59 pm
Re: Groverburger's 3D Engine (g3d) v1.5.2 Release
Since a cube is just six planes put togheter you can simply add the remaining sides to the above code snippet like so:
Code: Select all
local verts = {
-- top
{0,1,1, 0,0},
{0,0,1, 0,1},
{1,1,1, 1,0},
{0,0,1, 0,1},
{1,0,1, 1,1},
{1,1,1, 1,0},
-- bottom
{0,0,0, 1,0},
{0,1,0, 1,1},
{1,1,0, 0,1},
{1,0,0, 0,0},
{0,0,0, 1,0},
{1,1,0, 0,1},
-- side 1
{0,0,1, 0,0},
{0,0,0, 0,1},
{1,0,1, 1,0},
{0,0,0, 0,1},
{1,0,0, 1,1},
{1,0,1, 1,0},
-- side 2
{0,1,0, 1,1},
{0,1,1, 1,0},
{1,1,1, 0,0},
{1,1,0, 0,1},
{0,1,0, 1,1},
{1,1,1, 0,0},
-- side 3
{0,0,0, 1,1},
{0,0,1, 1,0},
{0,1,1, 0,0},
{0,1,0, 0,1},
{0,0,0, 1,1},
{0,1,1, 0,0},
-- side 4
{1,0,1, 0,0},
{1,0,0, 0,1},
{1,1,1, 1,0},
{1,0,0, 0,1},
{1,1,0, 1,1},
{1,1,1, 1,0},
}
model = g3d.newModel(verts, "pathtotexture.png")
I'm way too sober for this...
- Hydrogen Maniac
- Citizen
- Posts: 79
- Joined: Sat Dec 19, 2015 9:59 pm
Re: Groverburger's 3D Engine (g3d) v1.5.2 Release
You can add all kinds of lighting effects using shaders. Groverburger shared a simple lighting shader earlier in the thread that might be to your liking:
viewtopic.php?f=5&t=86350&start=130
I'm way too sober for this...
Re: Groverburger's 3D Engine (g3d) v1.5.2 Release
Thank you Hydrogen Maniac. I figured it out from the link. ![Smile :)](./images/smilies/ms-smile.png)
EDIT:
1) There seems to be some sort of FOV problem with camera.lua. I replaced the fov value math.pi/2 to math.rad(60) and it looks better.
2) Also in init.lua calling love.graphics.setMeshCullMode("back") would be great, because normally you do not want to draw back faces for polygons to speed things up.
![Smile :)](./images/smilies/ms-smile.png)
EDIT:
1) There seems to be some sort of FOV problem with camera.lua. I replaced the fov value math.pi/2 to math.rad(60) and it looks better.
2) Also in init.lua calling love.graphics.setMeshCullMode("back") would be great, because normally you do not want to draw back faces for polygons to speed things up.
Who is online
Users browsing this forum: No registered users and 58 guests