Giter Club home page Giter Club logo

Comments (5)

hadronized avatar hadronized commented on May 25, 2024

Hello,

Yeah, I need to update the examples. I’m having a look at your example. Thanks for reaching out.

from luminance-rs.

hadronized avatar hadronized commented on May 25, 2024

Ok, so the problem comes in because of two configurations:

const TRIANGLE_VERTS: [Vertex; 3] = [
    ([-0.5, -0.5], [0.8, 0.5, 0.5]), // red bottom leftmost
    ([-0., 0.5], [0.5, 0.8, 0.5]), // green top
    ([0.5, -0.5], [0.5, 0.5, 0.8]) // blue bottom rightmost
];

This geometry is defined via CW spelling.

 let rdr_state = RenderState::default();

This enables CCW culling. So, what it means is that your triangle won’t show up because it’ll get culled (it’s facing backwards). You can fix that by either disabling culling:

    let rdr_state = RenderState::default().set_face_culling(None);

… or by telling to cull on CW direction:

    let rdr_state = RenderState::default().set_face_culling(FaceCulling::new(FaceCullingOrder::CW, FaceCullingMode::Back));

Or by leaving it the way it is but specifying your geometry in CCW direction:

    let rdr_state = RenderState::default().set_face_culling(FaceCulling::new(FaceCullingOrder::CW, FaceCullingMode::Back));

from luminance-rs.

hadronized avatar hadronized commented on May 25, 2024

On a more general note, what do you think should be the best here as default? CCW is very common among 3D tools (Blender, Maya, ZBrush, 3DS Max, etc.), but it can get confusing if you define your geometry in CW as you did – you might think of a bug while it’s not, it’s just a default configuration.

Note: I don’t like defaults, even though they are handy. I might set the default to no culling… should I?

from luminance-rs.

osmarks avatar osmarks commented on May 25, 2024

I don't really have much of a preference on culling order.
The triangle is displayed now, though, thanks.

from luminance-rs.

hadronized avatar hadronized commented on May 25, 2024

Happy you work it out. Thanks again for reaching out. I shall close this issue then.

from luminance-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.