Skip to content

Update shadows rendering#616

Merged
Grantim merged 4 commits intomasterfrom
Update_shadows_rendering
Oct 18, 2022
Merged

Update shadows rendering#616
Grantim merged 4 commits intomasterfrom
Update_shadows_rendering

Conversation

@Grantim
Copy link
Contributor

@Grantim Grantim commented Oct 17, 2022

No description provided.

@Grantim Grantim requested a review from Fedr October 17, 2022 18:47
ivec2 texSize = textureSize( pixels, 0 );
vec2 pos = gl_FragCoord.xy + shift;
vec2 pos = gl_FragCoord.xy;
if ( !convX )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use this shader for x convolution and for y convolution, shift can be applied only for one of them

#define INV_QUALITY 0.33333334
#define INV_NUM_SAMPLES 0.020833333
const float gaussWeights[] = float[6] (0.923, 0.726, 0.4867, 0.278, 0.135, 0.056);
const float invNorm = 0.161046;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we divide gaussWeights on this beforehand?

posShift = vec2(0.0,blurRadius /(6.0* float(texSize.y)));

float convSum = texture(pixels, pos).a;
for (int i=0;i<6;i=i+1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++i does not work?

GL_EXEC( glDisable( GL_MULTISAMPLE ) );
#endif
sceneFramebuffer_.copyTexture();
drawLowSize_(); // draw scene texture in low size for further convolve
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

convolve -> convolution

GL_EXEC( glBindFramebuffer( GL_FRAMEBUFFER, copyFramebuffer_ ) );

GL_EXEC( glBindTexture( GL_TEXTURE_2D, resTexture_ ) );
GL_EXEC( glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, size.x, size.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we reduce code by using GlTexture2 here?

float blurRadius{ 40.0f };
// value that describes blur quality, blur texture downscaling coefficient
// (0,1] 1 - is maximum quality, but it can affect performance on embedded systems
// 0.25 - recomended value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recomended -> recommended

@Grantim Grantim merged commit ebe433d into master Oct 18, 2022
@Grantim Grantim deleted the Update_shadows_rendering branch October 18, 2022 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants