<div dir="ltr"><div><div>Hi Francis,<br><br>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:<br>
<br>uniform lowp float vertexOpacity;<br><br></div>and then change color.w = 1.0 to color.w = vertexOpacity;<br></div><div><br></div><div>I didn't actually test this myself, but hopefully it works. Please let us know!<br>
</div>Pat<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jun 10, 2014 at 9:56 AM, Francis Moore <span dir="ltr"><<a href="mailto:francism@sensopia.com" target="_blank">francism@sensopia.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
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.<br>
<br>
I create my own material like this, using the default Blinn Phong shaders:<br>
vesShader::Ptr s_<u></u>defaultBlinnPhongVertexShader;<br>
vesShader::Ptr s_<u></u>defaultBlinnPhongFragmentShade<u></u>r;<br>
vesShaderProgram::Ptr s_<u></u>defaultBlinnPhongShaderProgram<u></u>;<br>
vesMaterial::Ptr s_defaultBlinnPhongMaterial;<br>
<br>
s_<u></u>defaultBlinnPhongVertexShader = vesSharedPtr<vesShader>(new vesShader(vesShader::Vertex));<br>
s_<u></u>defaultBlinnPhongFragmentShade<u></u>r = vesSharedPtr<vesShader>(new vesShader(vesShader::Fragment)<u></u>);<br>
s_<u></u>defaultBlinnPhongShaderProgram = vesSharedPtr<vesShaderProgram><u></u>(new vesShaderProgram());<br>
s_defaultBlinnPhongMaterial = vesSharedPtr<vesMaterial>(new vesMaterial());<br>
s_<u></u>defaultBlinnPhongVertexShader-<u></u>>setShaderSource(<u></u>vesBuiltinShaders::<u></u>vesBlinnPhong_vert());<br>
s_<u></u>defaultBlinnPhongFragmentShade<u></u>r->setShaderSource(<u></u>vesBuiltinShaders::<u></u>vesBlinnPhong_frag());<br>
s_<u></u>defaultBlinnPhongShaderProgram<u></u>->addShader(s_<u></u>defaultBlinnPhongVertexShader)<u></u>;<br>
s_<u></u>defaultBlinnPhongShaderProgram<u></u>->addShader(s_<u></u>defaultBlinnPhongFragmentShade<u></u>r);<br>
s_<u></u>defaultBlinnPhongShaderProgram<u></u>->addUniform(s_<u></u>modelViewUniform);<br>
s_<u></u>defaultBlinnPhongShaderProgram<u></u>->addUniform(s_<u></u>projectionUniform);<br>
s_<u></u>defaultBlinnPhongShaderProgram<u></u>->addUniform(s_<u></u>normalMatrixUniform);<br>
s_<u></u>defaultBlinnPhongShaderProgram<u></u>->addUniform(s_<u></u>lightDirectionUniform);<br>
s_<u></u>defaultBlinnPhongShaderProgram<u></u>->addVertexAttribute(s_<u></u>positionVertexAttribute, vesVertexAttributeKeys::<u></u>Position);<br>
s_<u></u>defaultBlinnPhongShaderProgram<u></u>->addVertexAttribute(s_<u></u>normalVertexAttribute, vesVertexAttributeKeys::<u></u>Normal);<br>
s_<u></u>defaultBlinnPhongShaderProgram<u></u>->addVertexAttribute(s_<u></u>colorVertexAttribute, vesVertexAttributeKeys::Color)<u></u>;<br>
s_defaultBlinnPhongMaterial-><u></u>addAttribute(s_<u></u>defaultBlinnPhongShaderProgram<u></u>);<br>
<br>
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.<br>
<br>
vesMapper::Ptr RendererVES::s_redConeMapper;<br>
s_redConeMapper = vesSharedPtr<vesMapper>(new vesMapper());<br>
s_redConeMapper-><u></u>setGeometryData(s_<u></u>coneGeometryData);<br>
s_redConeMapper->setColor(1.0, 0.0, 0.0, 0.5);<br>
<br>
Finally, I add the mapper to an actor and add it to the renderer:<br>
vesActor::Ptr coneActor = vesSharedPtr<vesActor>(<u></u>vesActor::Ptr(new vesActor()));<br>
coneActor->setMapper(s_<u></u>redConeMapper);<br>
coneActor->setMaterial(s_<u></u>anchorMaterial);<br>
coneActor->setTranslation(<u></u>position);<br>
<br>
kiwiViewer->renderer()-><u></u>addActor(coneActor);<br>
Where kiwiViewer is a class of type vesKiwiBaseApp::Ptr.<br>
<br>
The result is an opaque red cone. What did I missed?<br>
<br>
Thanks,<br>
Francis Moore<br>
Researcher<br>
Sensopia<br>
______________________________<u></u>_________________<br>
Ves mailing list<br>
<a href="mailto:Ves@public.kitware.com" target="_blank">Ves@public.kitware.com</a><br>
<a href="http://public.kitware.com/cgi-bin/mailman/listinfo/ves" target="_blank">http://public.kitware.com/cgi-<u></u>bin/mailman/listinfo/ves</a><br>
</blockquote></div><br></div>