decentraland / sdk-issues

issues, features requests and discussions related to sdk.
4 stars 4 forks source link

Strange rendering of a-minus primitives after setting different alpha-values #5

Closed acl-crypto closed 3 years ago

acl-crypto commented 6 years ago

I made a scene with a-minus-primitives and lots of different alpha-settings. Now there are strange opacity effects. Sometimes it works (looking "through" a window) and sometimes (depending on the "looking angle") I see "through" different walls, see pictures hanging inside a room from the outside and so on.... See video on discord-channel ("support-SDK"-channel)

belohlavek commented 6 years ago

https://cdn.discordapp.com/attachments/437689723020902410/469204081387372546/Decentraland_Preview_alpha-problem.mp4

menduz commented 6 years ago

@deltakosh any idea about how to workaround this?

deltakosh commented 6 years ago

Is this with Babylon.js? Looks weird. We have several tools to sort meshes based on distance to camera.

Unless all meshes are transparent? And then the way to fix it would be to make as transparent only the transparent meshes

acl-crypto commented 6 years ago

Maybe that helps: I mainly used boxes for the scene (to save vertices/triangles). So actually (almost) everything is boxes on top of another box (e.g. picture-frame(-box) on top of the wall(-box)).

One of my window-tsx-files looks like this: (see picture) prob180718

My materials are defined in the scene.tsx-file (to keep an overview regarding material-limits): <material id="Stone02" alpha={1} albedoTexture={'/textures/stone02.jpg'}/> <material id="glasseffect" alpha={0.3} albedoTexture={'/textures/glass.jpg'} /> <material id="woodeffect" alpha={1} albedoTexture={'/textures/wood.jpg'} /> <material id="woodeffect01" alpha={1} albedoTexture={'/textures/wood1.jpg'}/>

menduz commented 6 years ago

@deltakosh thanks. We are setting opacityTexture = albedoTexture by default. Will drop that behavior

deltakosh commented 6 years ago

Definitely the issue here;)

menduz commented 6 years ago

Please test using metaverse-api@next

We added <material hasAlpha={true} /> to enable alpha in textures

menduz commented 6 years ago

@acl-crypto

acl-crypto commented 6 years ago

@menduz After npm install metaverse-api@next I have an older api now (metaverse-api version: 4.0.0-20180718211325.commit-70f72bb (OUTDATED)). It was version 4.0.2 before. Problem still the same. Scene movement even worse. Should i try: npm install metaverse-api@latest ?

menduz commented 6 years ago

can you share a video ? On Thu, 19 Jul 2018 at 02:18 acl-crypto notifications@github.com wrote:

@menduz https://github.com/menduz After npm install metaverse-api@next I have an older api nox (metaverse-api version: 4.0.0-20180718211325.commit-70f72bb (OUTDATED)). It was version 4.0.2 before. Problem still the same. Scene movement even worse. Should i try: npm install metaverse-api@latest ?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/decentraland/sdk-issues/issues/5#issuecomment-406157846, or mute the thread https://github.com/notifications/unsubscribe-auth/AAP4EqxIZlzreDhkuOwDuc4yKM4-ey-gks5uIBbBgaJpZM4VVF7X .

acl-crypto commented 6 years ago

@menduz It`s still like this: https://cdn.discordapp.com/attachments/437689723020902410/469204081387372546/Decentraland_Preview_alpha-problem.mp4

menduz commented 6 years ago

We need to see the difference video, that part you say it is worse. Or a zip with your example or a reproduction to debug the problem.

acl-crypto commented 6 years ago

@menduz : I doublechecked it: Sorry, the movement problems (kind of "jerky movement") were a Firefox-browser issue. In Chrome the movement is OK like before:

So summary: OS: Windows 10, Browser: Chrome Before: metaverse-api 4.0.2, strange alpha/opacity-issues like in the video (see link above). After npm install metaverse-api(at)next: metaverse-api version: 4.0.0-20180718211325.commit-70f72bb (OUTDATED), still exactly the same opacity issues at the same angles/views. (Btw. i can go "through" walls now. ingoreCollision effect?) I made another video but it looks exactly the same like the old one

menduz commented 6 years ago

Ohh, well, we are going to need a reproduction zip to debug it. Can you provide at least a subset of your use case to test?

About ingoreCollision: we are changing it to withCollisions={true} for performance reasons and consistency with gltf/obj models

acl-crypto commented 6 years ago

@menduz I sent an Email to your github profile address

acl-crypto commented 6 years ago

@menduz There's another way to get this error/bug. Even without using alpha={1}: When I use a "normal" material (without loading anything) like: <material id="metallic" metallic={0.5} roughness={0.1} /> <plane scale={{ x: 1, y: 1, z: 1 }} position={{ x: 0, y: 0, z: 0 }} rotation={{ x: 0, y: 0, z: 0 }} color="#FFFFFF" material="#metallic" /> .... then everything is fine. When I load a file as texture like: <material id="chrome" albedoTexture={'/textures/chrome.jpg'} alphaTexture={'/textures/chrome.jpg'} /> <plane scale={{ x: 1, y: 1, z: 1 }} position={{ x: 0, y: 0, z: 0 }} rotation={{ x: 0, y: 0, z: 0 }} color="#FFFFFF" material="#chrome" /> .... I get the same strange opacity-effects (things disappearing related to view angle, seeing things through walls, etc.)

menduz commented 6 years ago

@acl-crypto please remove the alphaTexture from your materials and tell me if it works

acl-crypto commented 6 years ago

@menduz I deleted just the "main" texture (of the wall) and the scene works (even if I keep the other textures) See: With texture: https://cdn.discordapp.com/attachments/437689723020902410/472667285056782347/texture_bug_report_01.mp4 Without texture: https://cdn.discordapp.com/attachments/437689723020902410/472667367592165386/texture_bug_report_02.mp4

menduz commented 6 years ago

when you say main are you talking about the albedo texture?

acl-crypto commented 6 years ago

I have/had 9 materials. All with different alpha, albedoTexture and alphaTexture. I only deleted one of these textures (the texture of all of the walls .... see videos before and after deleting this one texture) .... and then it worked !