KGLX - Rendering Issues
- PH3NOM
- DC Developer
- Posts: 576
- https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
- Joined: Fri Jun 18, 2010 9:29 pm
- Has thanked: 0
- Been thanked: 5 times
KGLX - Rendering Issues
So, I have just recently started programming with OpenGL.
Using KGLX on DC, so far the results are good
Models are in the format MD2
Texture filter is set to PVR_FILTER_BLINEAR, the only thing that could help is Mip-Mapping
I have managed to work out a basic camera implementation
So far so good
But problems occur with clipping of large polygons
Also obviously transparency not working correctly
So I post here for help with Clipping and Transparency. Any comments appreciated.
Using KGLX on DC, so far the results are good
Models are in the format MD2
Texture filter is set to PVR_FILTER_BLINEAR, the only thing that could help is Mip-Mapping
I have managed to work out a basic camera implementation
So far so good
But problems occur with clipping of large polygons
Also obviously transparency not working correctly
So I post here for help with Clipping and Transparency. Any comments appreciated.
- BlueCrab
- The Crabby Overlord
- Posts: 5658
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: KGLX - Rendering Issues
I've never used KGLX, but from a hardware standpoint I might be able to at least partially explain things. Just prefacing it with that I've never used KGLX, so I don't know for sure if these are the issues you're running into or not...
With the original KGL that is included with KOS in kos-ports, you have to actually switch primitive lists, just like you would using the PVR directly. That means that you have to actually tell it that you're going to start rendering translucent polygons before you do so. With the original KGL, this is done by calling glKosFinishList() until it would open up the translucent list (if you're using the normal PVR init and not doing anything fancy, just once would do the trick after you're done with everything that's opaque). I don't know for sure if this is the same in KGLX, but it might explain the problems with transparency that you're seeing.
As for the clipping issue you're seeing, I can't think of anything off the top of my head that would cause that particular issue. If I had to guess, I'd say its probably that the polygon is getting culled, so check how you're handling culling and what KGLX does by default with that.
With the original KGL that is included with KOS in kos-ports, you have to actually switch primitive lists, just like you would using the PVR directly. That means that you have to actually tell it that you're going to start rendering translucent polygons before you do so. With the original KGL, this is done by calling glKosFinishList() until it would open up the translucent list (if you're using the normal PVR init and not doing anything fancy, just once would do the trick after you're done with everything that's opaque). I don't know for sure if this is the same in KGLX, but it might explain the problems with transparency that you're seeing.
As for the clipping issue you're seeing, I can't think of anything off the top of my head that would cause that particular issue. If I had to guess, I'd say its probably that the polygon is getting culled, so check how you're handling culling and what KGLX does by default with that.
- PH3NOM
- DC Developer
- Posts: 576
- Joined: Fri Jun 18, 2010 9:29 pm
- Has thanked: 0
- Been thanked: 5 times
Re: KGLX - Rendering Issues
Thanks BlueCrab!BlueCrab wrote:With the original KGL that is included with KOS in kos-ports, you have to actually switch primitive lists, just like you would using the PVR directly.
I didnt realize that the list must be switched manually. That helped me solve the problem.
After that was fixed, I realized there was also something else going on.
The texture still looked pretty much like the previous post.
This problem was because I created the texture using GL_DECAL:
Code: Select all
glTexEnvi( GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_DECAL );
Furthermore, the blending mode must be set to achieve the desired transparency level:
Code: Select all
glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA ); /* Fully Transparent */
Code: Select all
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); /* Semi Transparent */
- PH3NOM
- DC Developer
- Posts: 576
- Joined: Fri Jun 18, 2010 9:29 pm
- Has thanked: 0
- Been thanked: 5 times
Re: KGLX - Rendering Issues
Having fun with transparent textures
And abusing the mess out of the SH4 ( ~20fps )
Wrote a basic skybox render function
But still having problems with clipping
Nobody has any ideas here? If needed, I can post some relevant code...
And abusing the mess out of the SH4 ( ~20fps )
Wrote a basic skybox render function
But still having problems with clipping
Nobody has any ideas here? If needed, I can post some relevant code...
Re: KGLX - Rendering Issues
Hello Phenom !
Is it possible to look at the source code ? It would be easier to find your clipping problem.
Is it possible to look at the source code ? It would be easier to find your clipping problem.
Alice Dreams Tournament Dreamcast fans : http://www.facebook.com/alicedreamst
In August 2015, we had to change "Dynamite Dreams" name to "Alice Dreams Tournament"
In August 2015, we had to change "Dynamite Dreams" name to "Alice Dreams Tournament"
-
- DCEmu Freak
- Posts: 54
- Joined: Tue Aug 30, 2011 3:29 am
- Has thanked: 0
- Been thanked: 0
- PH3NOM
- DC Developer
- Posts: 576
- Joined: Fri Jun 18, 2010 9:29 pm
- Has thanked: 0
- Been thanked: 5 times
Re: KGLX - Rendering Issues
Check your inbox. I sent you a link to my source via PM.patbier wrote:Hello Phenom !
Is it possible to look at the source code ? It would be easier to find your clipping problem.
Nope. I am developing independently.Neoblast wrote:Wow that's very nice. So you're working on the next "Hypertension" ?
As things turn out, that project only needed modelers.
Anyway, here are some latest screens of what Im working on...
For the curious, here is a cdi to check out the demo Because Patbier said his K:OS did not come with KGLX, I will post the library here:
- RyoDC
- Mental DCEmu
- Posts: 366
- Joined: Wed Mar 30, 2011 12:13 pm
- Has thanked: 2 times
- Been thanked: 0
Re: KGLX - Rendering Issues
Can I look at the source code too?
How do I try to build a Dreamcast toolchain:
- PH3NOM
- DC Developer
- Posts: 576
- Joined: Fri Jun 18, 2010 9:29 pm
- Has thanked: 0
- Been thanked: 5 times
Re: KGLX - Rendering Issues
Do you think you can help solve the clipping problem?RyoDC wrote:Can I look at the source code too?
Because Im not ready to release the source, publicly...
Patbier and myself have worked together in the past, and he has trusted me with some of his sources.
But, if you have any questions about it, I would be happy to answer, and even share snippets of code / logic.
Re: KGLX - Rendering Issues
Looking at the libkglx file you are using, I think you are using the same version as Heinrich Tillack (author of Iris3D), the 0.41, isn't it?
Did you try with Chui's implementation? I understand that it is more advanced and is compatible with OpenGl 1.2, but I don't know exactly how far did he arrive. I sent you a PM with the details, but maybe that clipping problem is already solved!
Did you try with Chui's implementation? I understand that it is more advanced and is compatible with OpenGl 1.2, but I don't know exactly how far did he arrive. I sent you a PM with the details, but maybe that clipping problem is already solved!
- PH3NOM
- DC Developer
- Posts: 576
- Joined: Fri Jun 18, 2010 9:29 pm
- Has thanked: 0
- Been thanked: 5 times
Re: KGLX - Rendering Issues
Well, I still have not looked at the"Chui" build.Indiket wrote:Looking at the libkglx file you are using, I think you are using the same version as Heinrich Tillack (author of Iris3D), the 0.41, isn't it?
Did you try with Chui's implementation? I understand that it is more advanced and is compatible with OpenGl 1.2, but I don't know exactly how far did he arrive. I sent you a PM with the details, but maybe that clipping problem is already solved!
But I did look at the /examples/ included in the kglx-0.4.1 package you sent me, as they were not included with kos.
I did realize that DC uses "slightly" different z-clipping than normal gl.
Code: Select all
glEnable(GL_KOS_NEARZ_CLIPPING);
The skybox is rendered fine, I just need to fix the rotations for the *new texture format being used for environment map.
- Neoblast
- DC Developer
- Posts: 314
- Joined: Sat Dec 01, 2007 8:51 am
- Has thanked: 3 times
- Been thanked: 1 time
Re: KGLX - Rendering Issues
Do you get full 60 fps in these tests? Tried chui's version?
It's more advanced
It's more advanced
- PH3NOM
- DC Developer
- Posts: 576
- Joined: Fri Jun 18, 2010 9:29 pm
- Has thanked: 0
- Been thanked: 5 times
Re: KGLX - Rendering Issues
Yeah, Indiket sent me Chui's KGLX some time ago. In the end, it was not any faster and led to some transparency problems.Neoblast wrote:Do you get full 60 fps in these tests? Tried chui's version?
It's more advanced
But yes, now things are rendered at Full 640x480p@60fps.
Thanks to some small optimizations advised by Bouz on the forums here, DC-Engine-3D is capable of Rendering ~50,000 polys/second
And there is still some room to optimize
- Attachments
-
- dc-engine-3d-111012.rar
- (1.99 MiB) Downloaded 104 times
-
- DC Developer
- Posts: 105
- Joined: Sun Oct 04, 2009 11:13 am
- Has thanked: 2 times
- Been thanked: 90 times
Re: KGLX - Rendering Issues
That doesn't actually run at 60 FPS on real hardware. It's 30 FPS when looking up into the sky, and 20 FPS when looking at the grass.
- PH3NOM
- DC Developer
- Posts: 576
- Joined: Fri Jun 18, 2010 9:29 pm
- Has thanked: 0
- Been thanked: 5 times
Re: KGLX - Rendering Issues
Thank you for testing. Right now my DC is broken and i can not test.TapamN wrote:That doesn't actually run at 60 FPS on real hardware. It's 30 FPS when looking up into the sky, and 20 FPS when looking at the grass.
I have re-written the render code, now based on meshes optimized for use with glVertexPointer().
Code: Select all
void DCE_GlRenderArray( DCE_MESH * mesh )
{
glBindTexture(GL_TEXTURE_2D, mesh->texaddr);
glVertexPointer(3, GL_FLOAT, 0, mesh->vert);
glEnableClientState(GL_VERTEX_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, mesh->texcoord);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
if(mesh->primitive==DCE_RENDER_QUAD)
glDrawArrays(GL_QUADS, 0, mesh->verts*mesh->primitive );
else
glDrawArrays(GL_TRIANGLES, 0, mesh->verts*mesh->primitive );
glDisableClientState(GL_VERTEX_ARRAY);
}
Can someone test on real hardware?
- Attachments
-
- dc-engine-3d-111212.rar
- (2.55 MiB) Downloaded 100 times
- RyoDC
- Mental DCEmu
- Posts: 366
- Joined: Wed Mar 30, 2011 12:13 pm
- Has thanked: 2 times
- Been thanked: 0
Re: KGLX - Rendering Issues
Phenom, tell me please, how do you debug your applications?
How do I try to build a Dreamcast toolchain:
-
- DC Developer
- Posts: 105
- Joined: Sun Oct 04, 2009 11:13 am
- Has thanked: 2 times
- Been thanked: 90 times
Re: KGLX - Rendering Issues
The newest one doesn't even seem to render. I can see the console output of the initialization and FPS counter, but get a black screen. It doesn't freeze completely, as the FPS counter still periodically updates. I couldn't get the controller or keyboard to do anything, like quit the program, either.
- PH3NOM
- DC Developer
- Posts: 576
- Joined: Fri Jun 18, 2010 9:29 pm
- Has thanked: 0
- Been thanked: 5 times
Re: KGLX - Rendering Issues
Well when it first loads, the mesh will be behind you so just use the d-pad to turn around.TapamN wrote:The newest one doesn't even seem to render. I can see the console output of the initialization and FPS counter, but get a black screen. It doesn't freeze completely, as the FPS counter still periodically updates. I couldn't get the controller or keyboard to do anything, like quit the program, either.
Well, I dont use a debugger, really.RyoDC wrote:Phenom, tell me please, how do you debug your applications?
When things dont work as I suspect they should, I start throwing some printf() statements to track the progress.
Most DC devs probably frown on me for doing so much testing using an emulator, lol.
If you have more specific questions, feel free to shoot me a PM.