Improving the demo render quality and performance

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Improving the demo render quality and performance

Postby Dave Gravel » Sun Feb 03, 2019 3:14 pm

I use glsl with only the normal gl debug.
It can debug simple error from shader load and it say the line.
I don't have test about if I can print peronal debug from the shader.

Maybe it can help for the matrix.
I have already read somewhere old gl is limited about array size.
I'm not sure if it depend from the video card or from the shader in self.
https://www.opengl.org/discussion_board ... ent-shader
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 712
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Improving the demo render quality and performance

Postby JoeJ » Sun Feb 03, 2019 4:10 pm

Julio Jerez wrote:I cant believe there is not a glsl debugger available or a lest I have no fond any.


There are several tools, i think this is most common for GL: https://github.com/baldurk/renderdoc

But there is nothing where you can step into shader code, AFAIK.

So what i do is using a shader storage buffer (hope i remember the name correctly - just a buffer of main GPU RAM), and i give this buffer to each shader as long as i work on it.
In the shader i put numbers into the buffer, and i display them at runtime on screen. So some kind of logging but no strings.

It's some work to setup. If skinning is all you want to add, it's likely not worth it.
User avatar
JoeJ
 
Posts: 1147
Joined: Tue Dec 21, 2010 6:18 pm

Re: Improving the demo render quality and performance

Postby Julio Jerez » Sun Feb 03, 2019 4:12 pm

woohoo!!
I found the bug, it was the matrix transpose at rendering time, I was transpose then when build teh display list, by then when rendering I was not, by making teh transpose calculation a function solve the problem. now it look like this

Code: Select all
void DemoSkinMesh::Render (DemoEntityManager* const scene)
{
#if 1
   dMatrix* const bindMatrix = dAlloca(dMatrix, m_nodeCount);
   int count = CalculateMatrixPalette(bindMatrix);
   GLfloat* const glMatrixPallete = dAlloca(GLfloat, 16 * count);
   ConvertToGlMatrix(count, bindMatrix, glMatrixPallete);

   glUseProgram(m_shader);
   int matrixPalette = glGetUniformLocation(m_shader, "matrixPallete");
   glUniformMatrix4fv(matrixPalette, count, FALSE, glMatrixPallete);
   glCallList(m_mesh->m_optimizedOpaqueDiplayList);


and I get 2600 fps in release.

teh one last problem is to make use of instance array, so that the box stack and the high count is no affected, but I think I can stop here and move to the IK system now.

can you check it out and see if is good for you?
Julio Jerez
Moderator
Moderator
 
Posts: 10989
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Improving the demo render quality and performance

Postby JoeJ » Sun Feb 03, 2019 4:18 pm

Dave Gravel wrote:I have already read somewhere old gl is limited about array size.
I'm not sure if it depend from the video card or from the shader in self.


I assume if you load stuff into uniforms, they aim to go into small constant RAM on the CUs, not into main memory. So the size limit might be 64 KB or something.
For more you likely want to use shader storage buffers instead.

(I really forgot all about GFX - wrote a skinning shader 20 years ago...)
User avatar
JoeJ
 
Posts: 1147
Joined: Tue Dec 21, 2010 6:18 pm

Re: Improving the demo render quality and performance

Postby Julio Jerez » Sun Feb 03, 2019 4:29 pm

When I query the max number of uniforms, I get 16000 floats, or not and 4096 vectors, that's 64 k, yes
In matrices is about 1024, more than enough.
But Dave is right, older shader versions only used to support up to 256 vectors, which is 64 matrices.
I remember in the Xbox and ps3 having to right tools to splits mesh in segments that do not use more than 40 or 50 unique bones.

Did you tested Joe, can you check it out to see if it works in your system?
Julio Jerez
Moderator
Moderator
 
Posts: 10989
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Improving the demo render quality and performance

Postby JoeJ » Sun Feb 03, 2019 4:31 pm

I'll give it a try...
User avatar
JoeJ
 
Posts: 1147
Joined: Tue Dec 21, 2010 6:18 pm

Re: Improving the demo render quality and performance

Postby JoeJ » Sun Feb 03, 2019 4:37 pm

Seems to work! I see a breathing guy in holding gun pose. Skinning works.
Dbg: 1000 fps, Rel.: 1400 fps
GPU is AMD FuryX
User avatar
JoeJ
 
Posts: 1147
Joined: Tue Dec 21, 2010 6:18 pm

Re: Improving the demo render quality and performance

Postby Dave Gravel » Sun Feb 03, 2019 4:45 pm

Edited:
Here the animation don't work with mode #1 shadered version.
I get only the animation with the direct render #0 mode.
https://www.youtube.com/watch?v=JZy-lWnfSQ0
--
I get the same fps with the shadered version if I compare with the test before but the character stay at /|\ position.
Maybe it depend on the video card I get 1500 1600 fps in debug and 4000 fps or a bit more in release.
Last edited by Dave Gravel on Sun Feb 03, 2019 5:07 pm, edited 2 times in total.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 712
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Improving the demo render quality and performance

Postby JoeJ » Sun Feb 03, 2019 4:59 pm

For me it does work with both:
Code: Select all
void DemoSkinMesh::Render (DemoEntityManager* const scene)
{
#if 0

Setting to 0 i only get 500 fps in release, but it looks the same.

Edit: My lower FPS surely come from API overhead on slow CPU.
User avatar
JoeJ
 
Posts: 1147
Joined: Tue Dec 21, 2010 6:18 pm

Re: Improving the demo render quality and performance

Postby Julio Jerez » Sun Feb 03, 2019 5:50 pm

oh no I get the about 600 and Dave get similar fps, the overhead come for doing the vertex weight in teh CPU. the mesh has 12400 points, doing the weigh is not big deal by uploading teh data is wht kills the performance.

Dave is does work because in your system it fail to compile this shade
...\applications\media\shaders\SkinningDirectionalDiffuse.vs

the funtion that compile the shader is this
GLuint ShaderPrograms::CreateShaderEffect (const char* const vertexShaderName, const char* const pixelShaderName)

I do not know how to set glCompileShader(vertexShader); so that is tell what error happens.
I have to find out.
I am quite disappointed the GLSL is so limited, No debugger, no Errors,
it does seem liek is made any progress in 15 years.
Julio Jerez
Moderator
Moderator
 
Posts: 10989
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Improving the demo render quality and performance

Postby Julio Jerez » Sun Feb 03, 2019 6:02 pm

Dave I added erro log info now, can you sync again?

set a break point in these line 101 and 116 in file ...\toolBox\ShaderPrograms.cpp
Code: Select all
      glGetShaderInfoLog(vertexShader, sizeof (buffer), &length, errorLog);
      dTrace ((errorLog));


maybe you can get some error info from the shader compiler.
Julio Jerez
Moderator
Moderator
 
Posts: 10989
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Improving the demo render quality and performance

Postby Dave Gravel » Sun Feb 03, 2019 6:04 pm

Ok I test with the info.
Here for debug gl I use something like this.

https://sites.google.com/site/oxnewton/DebugGL.txt
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 712
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Improving the demo render quality and performance

Postby Julio Jerez » Sun Feb 03, 2019 6:11 pm

are you sure that's the erro log? It seem from some othe stuff.
if I add a erro to teh shader I get something like this

Vertex shader failed to compile with the following errors:
ERROR: 0:27: error(#132) Syntax error: "vec4" parse error
ERROR: error(#273) 1 compilation errors. No code generated
Julio Jerez
Moderator
Moderator
 
Posts: 10989
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Improving the demo render quality and performance

Postby Dave Gravel » Sun Feb 03, 2019 6:18 pm

No it's not the error log hehe.
It is the code that I use here in my engine for enable the opengl debug.
And I use the error info in shader the same in your demo.

I don't get error message from your demo, but the animation don't work.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 712
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Improving the demo render quality and performance

Postby Julio Jerez » Sun Feb 03, 2019 6:23 pm

but I saw the assert in the youtube video, is it returning an erro status.
can you break when the assert happens?

btw I added a stress test, 100 models and I get from 280 to 300 fps.
I would expect a little better but I take it because the CPU skinning is around form 7 to 8
Julio Jerez
Moderator
Moderator
 
Posts: 10989
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: Julio Jerez and 2 guests