Jump to content

Maximum Shadow Map Size


isidisi
 Share

Recommended Posts

  • 3 weeks later...

Maximum shadowmap size is the same as maximum texture size, and you can get it this way:

http://www.opengl.org/resources/faq/technical/texture.htm#text0120

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Maximum shadowmap size is the same as maximum texture size, and you can get it this way:

http://www.opengl.org/resources/faq/technical/texture.htm#text0120

 

 

yes glTexImage2D is the funcion I said to use, but what format is using Leadwerks to pass the right parameters to the function?

 

I tried with this code:

 

GLint testWidth = 256;

GLint resWidth;

 

while( true )

{

glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA8, testWidth, testWidth, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);

glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &resWidth);

 

if (resWidth == 0 )

{

resWidth = testWidth / 2;

break;

}

else

{

testWidth *=2;

}

}

 

and I obtained than my maximum texture size is 16384

but Leadwerks engine hungs when I select a shadowmapsize of 4096 or higher... I think is because I didn't pass the right parameters...

Link to comment
Share on other sites

I have debugged with glslDevil and I found that the call that Leadwerks is doing when I set ShadowmapSizeto 512 is:

 

glTexImage2D(GL_PROXY_TEXTURE_2D, 0, 33191, 1024, 1024, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL);

 

if I set ShadowmapSizeto 1024 then I see in the debugger:

glTexImage2D(GL_PROXY_TEXTURE_2D, 0, 33191, 2048, 2048, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL);

 

so always is creating a texture 2 * ShadowmapSize

 

Then we have to divide by 2 the max texture calculated in the routine I posted.

resWidth /= 2;

 

and replace the glTexImage2D call with

glTexImage2D(GL_PROXY_TEXTURE_2D, 0, 33191, testWidth, testWidth, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL);

 

 

Using 33191 and GL_DEPTH_COMPONENT as parameters, my max texture size is 8192, then my max shadomapsize is 4096.

I tried this with a simple program with a rotating cube and it's ok, works with 4096 and not with 8192 :-)

 

But if I load a big quantity of models the 4096 doesn't works anymore, I think as you say because then there's not enough memory to allocate both models and texture... but at least there's a way to detect max shadowmap size because of max texture size...

 

Thanks lumooja

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...