Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrapmode mirror_once is redundant #516

Closed
nearnshaw opened this issue Dec 13, 2022 · 1 comment
Closed

Wrapmode mirror_once is redundant #516

nearnshaw opened this issue Dec 13, 2022 · 1 comment
Assignees
Labels
api-change Signals a potential breaking change in the API renderer
Milestone

Comments

@nearnshaw
Copy link
Member

nearnshaw commented Dec 13, 2022

When configuring a texture, the wrapMode has options TWM_MIRROR and TWM_MIRROR_ONCE, both look like they produce identical results.

We might want to remove Mirror_once, or make it only has one axis of symmetry

See this example, where two planes have these different modes set, but look identical:

example

See this doc for reference about what each should do:
https://learnopengl.com/Getting-started/Textures

@nearnshaw nearnshaw added this to SDK Dec 13, 2022
@nearnshaw nearnshaw converted this from a draft issue Dec 13, 2022
@nearnshaw nearnshaw added this to the SDK 7.1 - Beta milestone Dec 13, 2022
@nearnshaw nearnshaw moved this to Todo in SDK Dec 13, 2022
@menduz menduz modified the milestones: SDK 7.1 - Beta, SDK 7.2 - Public release Dec 20, 2022
@menduz menduz added the api-change Signals a potential breaking change in the API label Dec 20, 2022
@pbosio pbosio added the renderer label Jan 6, 2023
@nearnshaw nearnshaw modified the milestones: SDK 7.2 - Public release, Workspace Mar 2, 2023
@nearnshaw nearnshaw removed the status in SDK Mar 2, 2023
@AN-DCL AN-DCL moved this to Todo in SDK Mar 3, 2023
@nearnshaw nearnshaw removed the status in SDK Mar 15, 2023
@pravusjif pravusjif moved this to Todo in SDK May 9, 2023
@pravusjif pravusjif self-assigned this May 19, 2023
@pravusjif pravusjif moved this from Todo to In Progress in SDK May 19, 2023
@pravusjif
Copy link
Member

pravusjif commented May 19, 2023

I confirm that his looks like a problem with WebGL, since using the following test code I get the expected results in Unity Editor but not in the web build.

Screen Shot 2023-05-19 at 14 10 32 Screen Shot 2023-05-19 at 14 13 23
function setUVs(rows: number, cols: number) {
  return [
    // North side of unrortated plane
    0, //lower-left corner
    0,

    cols, //lower-right corner
    0,

    cols, //upper-right corner
    rows,

    0, //upper left-corner
    rows,

    // South side of unrortated plane
    cols, // lower-right corner
    0,

    0, // lower-left corner
    0,

    0, // upper-left corner
    rows,

    cols, // upper-right corner
    rows,
  ]
}

const meshEntity = engine.addEntity()
Transform.create(meshEntity, {
  position: Vector3.create(4, 3.5, 4),
  scale: Vector3.create(4, 4, 4) })
MeshRenderer.setPlane(meshEntity, setUVs(4, 4))
MeshCollider.setPlane(meshEntity)
const textureSource = 'images/scene-thumbnail.png'
Material.setPbrMaterial(meshEntity, {
  texture: Material.Texture.Common({
    src: textureSource,
    wrapMode: TextureWrapMode.TWM_MIRROR,
  }),
  castShadows: true,
  roughness: 1,

})

const meshEntity2 = engine.addEntity()
Transform.create(meshEntity2, {
  position: Vector3.create(9, 3.5, 4),
  scale: Vector3.create(4, 4, 4) })
MeshRenderer.setPlane(meshEntity2,setUVs(4, 4))
Material.setPbrMaterial(meshEntity2, {
  texture: Material.Texture.Common({
    src: textureSource,
    wrapMode: TextureWrapMode.TWM_MIRROR_ONCE,
  }),
  castShadows: true,
  roughness: 1,
})

I'll be removing the TWM_MIRROR_ONCE option since is the one that doesn't work in WebGL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-change Signals a potential breaking change in the API renderer
Projects
Status: Done
Development

No branches or pull requests

4 participants