Git Product home page Git Product logo

Comments (4)

MasDennis avatar MasDennis commented on July 20, 2024

Maybe try a discard in the fragment shader?

if(basecolor.a == 0.0){
discard;
}

from rajawali.

contrast-zz avatar contrast-zz commented on July 20, 2024

Hello Dennis,

Thank you for the response, but I don't think I was clear with my original question. I would like parts of the texture to be semi-transparent. I believe the discard you were referring to would remove those pixels completely, correct?

The png I provide for the texture has alpha values ranging from 0 to 1 with many values in between, but the way it gets rendered it looks as though the values are all either 0 or 1. Does that make sense?

Basically I want to be able to have a plane textured with an image of a cloud or and to have parts of it be semi-transparent. I know there is the fog feature I can enable, but I don't have as much control over it and it's not quite the look I am going for.

The person in this link asks the same question, but about opengl in general, if that clears things up:
http://stackoverflow.com/questions/3634444/android-opengles-alpha-textures-not-semitransparent-but-binary-transparent

Thanks for your help.

from rajawali.

MasDennis avatar MasDennis commented on July 20, 2024

Yeah, I see what you mean. The Z-buffer must be disabled when you use transparency. Basically you have to reorder the objects based on the distance to the camera. This way they should render properly. Check http://www.opengl.org/wiki/Transparency_Sorting#Depth_Sorting

from rajawali.

rootko avatar rootko commented on July 20, 2024

And how do we do that in Rajawali framework?
Thanks, Rudo.

Edit: I found the answer in Issue 100 -
mObject.setMaterial(new SimpleMaterial());
mObject.setBlendingEnabled(true);
mObject.setBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);

from rajawali.

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.