StarArawn / harmony

A modern 3D/2D game engine that uses wgpu.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Resize cube example crashed

happydpc opened this issue · comments

Here is the failed info, when resize the skybox may need to recreate.

thread '' panicked at 'assertion failed: (left == right)
left: Extent { width: 1280, height: 960, depth: 1 },
right: Extent { width: 1280, height: 963, depth: 1 }: Extent state must match extent from view'

commented

@happydpc Issue should be fixed now. Let me know if that isn't the case!

Yes, it's ok now.

Seems that the skybox not resized when resize the window. And I am wondering why there's a hole in the realtime skybox?

image

commented

@happydpc Yeah that is a known issue I'm currently re-writing the skybox stuff in a separate branch, but our asset loading is a higher priority atm.

Oh, I see. Hope we can achieve this result.
image

I have tested some cube with pure color, main color is white. But comes out this. I am wondering is there anything missing? the light? Thank you.
image

commented

That is another known issue! Essentially the shader doesn't know that it needs to not use the texture. We need to come up with a soultion for this. Some research needs to be done to figure out how we can work in compile time configurations. The other thing we could do is pass in more uniform data to tell the shader that we don't have a texture.
This code here:
https://github.com/StarArawn/harmony/blob/master/assets/core/shaders/pbr_fragment.glsl#L145
should look more like:

if hasTexture {
  main_color = texture(sampler2D(main_map, tex_sampler), i_uv).rgb * color.rgb;
} else {
  main_color = color.rgb;
}

Yes, there needs some auto switch. Thank you for your tip. Can't wait to test the asset loading. Good job.