Awesome tool! I could totally use this to try and learn 3d in LOVE. Though i think that most users of this library is going to need a wiki documenting the API.
Also, question, how does one apply collision and basic lighting with this?
Groverburger's 3D Engine (g3d) v1.5.2 Release
- yetneverdone
- Party member
- Posts: 448
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: Groverburger's 3D Engine (G3D) New and Improved!
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
- groverburger
- Prole
- Posts: 49
- Joined: Tue Oct 30, 2018 9:27 pm
Re: Groverburger's 3D Engine (G3D) New and Improved!
Cool project! Glad I could help.JJSax wrote: ↑Mon Oct 26, 2020 10:16 pm Thanks for the tool! I used ss3d to create my solar system scale, I'm excited that the project isn't dead! Great work!
If you're interested in what you made possible: https://youtu.be/c_zMSnKyZc8
- groverburger
- Prole
- Posts: 49
- Joined: Tue Oct 30, 2018 9:27 pm
Re: Groverburger's 3D Engine (G3D) New and Improved!
Thanks for the kind words!yetneverdone wrote: ↑Fri Oct 30, 2020 3:47 am Awesome tool! I could totally use this to try and learn 3d in LOVE. Though i think that most users of this library is going to need a wiki documenting the API.
Also, question, how does one apply collision and basic lighting with this?
I agree though. I'm procrastinating on documentation because there are still a few things I'd like to change with g3d right now like moving everything out of the global namespace. I do agree it would be helpful - I intend to get to it soon™.
Collision is kinda half-baked at the moment. There is a polygon-ray call you can use, but I think some implementation of the GJK algorithm would be helpful. Lighting can be done by applying a custom shader like so:
Code: Select all
thisModel.shader = myLightingShader
There some tutorials online about lighting shaders in GLSL, like this one, but they can be tricky to translate into love's flavor of shading language.
- yetneverdone
- Party member
- Posts: 448
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: Groverburger's 3D Engine (G3D) New and Improved!
Oh my bad, i didn't specify what i meant by lighting. What I meant was environmental lighting like shadow and flashlight.
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Re: Groverburger's 3D Engine (G3D) New and Improved!
Just being realistic here. It might be better for you to try a higher-level engine that already comes with those features, like Unreal or Unity, where you mostly tick the box on the light object to turn on real-time shadows for it, and add a texture projector with additive-blend mode for the flashlight effect.yetneverdone wrote: ↑Sun Nov 01, 2020 1:54 pm Oh my bad, i didn't specify what i meant by lighting. What I meant was environmental lighting like shadow and flashlight.
Otherwise you'd have to implement these things into this engine. Depending on your skillset, this would not help you get closer to your goal of making a simple 3D game but sidetrack it.
- yetneverdone
- Party member
- Posts: 448
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: Groverburger's 3D Engine (G3D) New and Improved!
Yeah I have no experience with 3D at all (except a couple of basic know-how in 3d modeling), but I want to learn it using LOVEVE and a framework/library like this could really help
I'm aiming for something very simple like this game in terms of perspective and atmosphere, so maybe not really needing much lighting and shadow
I'm aiming for something very simple like this game in terms of perspective and atmosphere, so maybe not really needing much lighting and shadow
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Re: Groverburger's 3D Engine (G3D) New and Improved!
I don't see real-time or baked shadows in there, but I can see fog being used.
This article explains how to implement fog with a shader:
https://webglfundamentals.org/webgl/les ... l-fog.html
The fog factor can be the distance from the vertex to the camera (instead of just the depth of the vertex in relation to the camera plane, which would give you incorrect fog that changes depending on the rotation of the camera towards the object).
Based on the default shader in Groveburger3D, and provided that you send in a uniform with the position of the camera, it'd be something like the following (UNTESTED):
This article explains how to implement fog with a shader:
https://webglfundamentals.org/webgl/les ... l-fog.html
The fog factor can be the distance from the vertex to the camera (instead of just the depth of the vertex in relation to the camera plane, which would give you incorrect fog that changes depending on the rotation of the camera towards the object).
Based on the default shader in Groveburger3D, and provided that you send in a uniform with the position of the camera, it'd be something like the following (UNTESTED):
Code: Select all
uniform vec3 worldCameraPosition
varying float distanceToCamera
#ifdef VERTEX
vec4 position(mat4 transform_projection, vec4 vertex_position)
{
distanceToCamera = length(worldcameraPosition - vertex_position.xyz);
return projectionMatrix * viewMatrix * modelMatrix * vertex_position;
}
#endif
#ifdef PIXEL
vec4 effect(vec4 color, Image tex, vec2 texcoord, vec2 pixcoord)
{
vec4 texcolor = Texel(tex, texcoord);
if (texcolor.a == 0.0) { discard; }
// Plug 'distanceToCamera' into some formula that darkens 'texcolor' (the pixel color).
const float MIN_DISTANCE = 10.0;
const float MAX_DISTANCE = 30.0;
const float fogInterval = MAX_DISTANCE - MIN_DISTANCE;
float fogFactor = clamp(distanceToCamera - MIN_DISTANCE, 0.0, fogInterval) / fogInterval;
texcolor = mix(texcolor, vec4(0.0), fogFactor);
return vec4(texcolor);
}
#endif
- groverburger
- Prole
- Posts: 49
- Joined: Tue Oct 30, 2018 9:27 pm
Re: Groverburger's 3D Engine (G3D) New and Improved!
This could definitely be achieved in g3d. I wrote some documentation in the wiki on the Github repo.yetneverdone wrote: ↑Mon Nov 02, 2020 4:18 am Yeah I have no experience with 3D at all (except a couple of basic know-how in 3d modeling), but I want to learn it using LOVEVE and a framework/library like this could really help
I'm aiming for something very simple like this game in terms of perspective and atmosphere, so maybe not really needing much lighting and shadow
Hopefully it'll be helpful!
Here's the link to the g3d wiki: https://github.com/groverburger/g3d/wiki
- yetneverdone
- Party member
- Posts: 448
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: Groverburger's 3D Engine (g3d) v1.2 Release
Yeah im keeping an eye on the lib, but why is the lib global? I think people would want the lib/framework to be localized and decoupled globally.
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
- groverburger
- Prole
- Posts: 49
- Joined: Tue Oct 30, 2018 9:27 pm
Re: Groverburger's 3D Engine (g3d) v1.2 Release
Yeah I understand that complaint - I'm considering doing kinda what p5js does and having a global/non-global version of the lib.yetneverdone wrote: ↑Sat Jan 16, 2021 7:01 am Yeah im keeping an eye on the lib, but why is the lib global? I think people would want the lib/framework to be localized and decoupled globally.
The main reason the lib is global is because I pulled the files that are now called g3d out of a project I was working on and I didn't change them to be non-global.
I'm worried changing this that would break compatibility, and I've already broken compatibility once.
I also think having the lib in the global namespace may make the source code easier for people to read and understand themselves, which is something I aim for with g3d.
So, I'm open to more feedback here.
(Also if anyone is wondering I mistyped and titled this update v1.2 when I should have typed v1.1 -- oops!)
Who is online
Users browsing this forum: Google [Bot] and 2 guests