[Ves] Transparency

Pat Marion james.patrick.marion at gmail.com
Tue Jun 10 10:11:19 EDT 2014


Hi Francis,

I just looked at the source for vesBlinnPhong_frag.glsl in ves master
(d1506467a) and it does not respect the transparency you have defined (line
61 just sets color.w = 1.0).  The issue is that the blinn phong shader is
not reading the vertexOpacity uniform.  You could modify
vesBlinnPhong_frag.glsl and recompile.  Add this line at the top:

uniform lowp float vertexOpacity;

and then change color.w = 1.0 to color.w = vertexOpacity;

I didn't actually test this myself, but hopefully it works. Please let us
know!
Pat



On Tue, Jun 10, 2014 at 9:56 AM, Francis Moore <francism at sensopia.com>
wrote:

> Hi,
>
> I am a researcher at Sensopia. In the last week, our team was able to
> rebuild the OpenGL interface of our app with VES on Android and on iOS.
> This transition greatly simplified our code and the app look better than
> ever, thanks to your great work on VES. There’s one thing that I did not
> understand: how transparency work in VES. I did not use the Kiwi class,
> because I want full control over the actor and the mapper. So here what I
> did and if you can tell me what is missing or wrong, it will help me a lot.
>
> I create my own material like this, using the default Blinn Phong shaders:
> vesShader::Ptr s_defaultBlinnPhongVertexShader;
> vesShader::Ptr s_defaultBlinnPhongFragmentShader;
> vesShaderProgram::Ptr s_defaultBlinnPhongShaderProgram;
> vesMaterial::Ptr s_defaultBlinnPhongMaterial;
>
> s_defaultBlinnPhongVertexShader = vesSharedPtr<vesShader>(new
> vesShader(vesShader::Vertex));
> s_defaultBlinnPhongFragmentShader = vesSharedPtr<vesShader>(new
> vesShader(vesShader::Fragment));
> s_defaultBlinnPhongShaderProgram = vesSharedPtr<vesShaderProgram>(new
> vesShaderProgram());
> s_defaultBlinnPhongMaterial = vesSharedPtr<vesMaterial>(new vesMaterial());
> s_defaultBlinnPhongVertexShader->setShaderSource(vesBuiltinShaders::
> vesBlinnPhong_vert());
> s_defaultBlinnPhongFragmentShader->setShaderSource(vesBuiltinShaders::
> vesBlinnPhong_frag());
> s_defaultBlinnPhongShaderProgram->addShader(s_
> defaultBlinnPhongVertexShader);
> s_defaultBlinnPhongShaderProgram->addShader(s_
> defaultBlinnPhongFragmentShader);
> s_defaultBlinnPhongShaderProgram->addUniform(s_modelViewUniform);
> s_defaultBlinnPhongShaderProgram->addUniform(s_projectionUniform);
> s_defaultBlinnPhongShaderProgram->addUniform(s_normalMatrixUniform);
> s_defaultBlinnPhongShaderProgram->addUniform(s_lightDirectionUniform);
> s_defaultBlinnPhongShaderProgram->addVertexAttribute(s_positionVertexAttribute,
> vesVertexAttributeKeys::Position);
> s_defaultBlinnPhongShaderProgram->addVertexAttribute(s_normalVertexAttribute,
> vesVertexAttributeKeys::Normal);
> s_defaultBlinnPhongShaderProgram->addVertexAttribute(s_colorVertexAttribute,
> vesVertexAttributeKeys::Color);
> s_defaultBlinnPhongMaterial->addAttribute(s_defaultBlinnPhongShaderProgram
> );
>
> Then I create my geometry without defining color on the vertex and pass it
> to a mapper. I set the alpha to 0.5 on the mapper using setColor.
>
> vesMapper::Ptr RendererVES::s_redConeMapper;
> s_redConeMapper = vesSharedPtr<vesMapper>(new vesMapper());
> s_redConeMapper->setGeometryData(s_coneGeometryData);
> s_redConeMapper->setColor(1.0, 0.0, 0.0, 0.5);
>
> Finally, I add the mapper to an actor and add it to the renderer:
> vesActor::Ptr coneActor = vesSharedPtr<vesActor>(vesActor::Ptr(new
> vesActor()));
> coneActor->setMapper(s_redConeMapper);
> coneActor->setMaterial(s_anchorMaterial);
> coneActor->setTranslation(position);
>
> kiwiViewer->renderer()->addActor(coneActor);
> Where kiwiViewer is a class of type vesKiwiBaseApp::Ptr.
>
> The result is an opaque red cone. What did I missed?
>
> Thanks,
> Francis Moore
> Researcher
> Sensopia
> _______________________________________________
> Ves mailing list
> Ves at public.kitware.com
> http://public.kitware.com/cgi-bin/mailman/listinfo/ves
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/ves/attachments/20140610/5fa4ba6e/attachment-0003.html>


More information about the Ves mailing list