[Interest] Quick3D mapping of png textures onto Item 3D

Thomas Senyk thomas.senyk at pelagicore.com
Thu Sep 20 11:22:10 CEST 2012


It's working for me.
I did a fresh build from source and used an old example and it's working.
I just use the qmlviewer (don't forget the -opengl argument)


One important thing to know:
Doing blending in a generic way for a library is a quite tricky task.
To do it properly one would need to sort all surfaces by there position in the 
3D-space (and even that is not the end solution if you want to be perfect) 
which is in most cases not really necessary and would consume a lot of cpu.
So I assume that's why this is not done in QtQuick3D and therefor the blending 
isn't "optically correct".
But one should definitely see the blending! (adding a blue Rectangle as 
background helps "seeing it" ;) )



On Thu, September 20, 2012 02:40:13 PM Satya Praveen Ganapathi wrote:
> Hi,
> 
> I tried with the below code to resolve the transparent area of png shown
> as black shaded:-
> 
> ViewPort
> {
> Width:parent.width
> Height:parent.height
> blending:true
> 
> Quad{
> effect:Effect{
> texture:"img.png"
> }
> }
> 
> However, it still shows the transparent area of png file as black
> shaded.
> 
> Please let me know the solution or this is a known issue in Quick3D.
> 
> Best Regards,
> Satya
> 
> -----Original Message-----
> From: interest-bounces+praveen.s=hmie.co.in at qt-project.org
> [mailto:interest-bounces+praveen.s=hmie.co.in at qt-project.org] On Behalf
> Of Ramakanthreddy_Kesireddy
> Sent: Thursday, September 20, 2012 10:25 AM
> To: Thomas Senyk; interest at qt-project.org
> Subject: Re: [Interest] Quick3D mapping of png textures onto Item 3D
> 
> Hi,
> 
> We tried with below blending property in Effect but transparent area of
> the png file is
> still shown as black shaded.
> 
> 
> Quad{
> 
> Effect{
> texture:"img.png"
> blending:true
> }
> }
> 
> Could you please let us know if we are mssing anything in this regard.
> 
> Br,
> Ramakanth
> ________________________________________
> From:
> interest-bounces+ramakanthreddy_kesireddy=mahindrasatyam.com at qt-project.
> org
> [interest-bounces+ramakanthreddy_kesireddy=mahindrasatyam.com at qt-project
> .org] on behalf of Thomas Senyk [thomas.senyk at pelagicore.com]
> Sent: Wednesday, September 19, 2012 5:13 PM
> To: interest at qt-project.org
> Subject: Re: [Interest] Quick3D mapping of png textures onto Item 3D
> 
> As he is using QtQuick3D, the answer is simpler:
> http://doc.qt.digia.com/qt-quick3d-snapshot/qml-effect.html#blending-pro
> p
> 
> :)
> 
> Greets
> Thomas
> 
> On Tue, September 18, 2012 08:57:55 AM Till Oliver Knoll wrote:
> > 2012/9/18 Satya Praveen Ganapathi <praveen.s at hmie.co.in>:
> > > ...
> > > However, the png image is not getting displayed properly in 3D space
> 
> i.e.
> 
> > > transparent area of the png file is
> > > shown as black shaded.
> > 
> > Most probably you simply need to enable "alpha blending": In OpenGL
> > terms that usually means
> > 
> > a) Turn blending on: glEnable(GL_BLEND)
> > b) Define a blend function, e.g.: glBlendFunc(GL_SRC_ALPHA,
> > GL_ONE_MINUS_SRC_ALPHA)
> > 
> > Note: "Premultiplied alpha" textures (refer to Wikipedia or the Qt
> > docs about the same topic) are to be preferred, in which case you
> > would say glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)
> > 
> > Here is a guy who is trying /exactly/ the same thing as you:
> >   http://galfar.vevb.net/imaging/smf/index.php?topic=296.0
> > 
> > Depending on what you are trying to achieve the function glTexEnv()
> > with argument GL_BLEND might be useful too (if you want to apply alpha
> > blending at the moment when applying the texture - and if you want
> > that the underlying surface colour shines through). Refer to the
> 
> > (possibly outdated) FAQ:
> http://www.opengl.org/archives/resources/faq/technical/transparency.htm
> 
> > How you apply all this to Qt 3D I don't know - but I'm sure there must
> > be this big "Enable blending" switch somewhere, too - refer to the
> > docs (and if not, to my little understanding you can still mix in your
> > own "raw OpenGL" code as above, no?).
> > 
> > Cheers, Oliver
> > _______________________________________________
> > Interest mailing list
> > Interest at qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/interest
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
> 
> ________________________________
> 
> DISCLAIMER:
> This email (including any attachments) is intended for the sole use of
> the intended recipient/s and may contain material that is CONFIDENTIAL
> AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or
> copying or distribution or forwarding of any or all of the contents in
> this message is STRICTLY PROHIBITED. If you are not the intended
> recipient, please contact the sender by email and delete all copies;
> your cooperation in this regard is appreciated.
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Cube.qml
Type: text/x-qml
Size: 3087 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120920/ae4bfa44/attachment.bin>


More information about the Interest mailing list