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

Thomas Senyk thomas.senyk at pelagicore.com
Thu Sep 20 16:06:05 CEST 2012


So it seams you are using Qt5, right?

I'm not going to spend time polishing an example for QtQuick2.
But there is one you can use:
http://gitorious.org/qmlshowcase

All you have to do is go to demo10.qml and
-                color: display.theme.cubeTexColor
+//                color: display.theme.cubeTexColor
                 texture: "./media/qtlogo.png"
-                decal: true
+//                decal: true


I've attached a screenshot proving that it's working
(one can clearly see the colored stars in the background)


Unless you can give me a full(!) (not just a code-snipped) and minimal(!) (I'm 
not going to read 1000lins of code!) example showing that it's not working, I 
can't help you much more.

If you write a example make sure that you have something behind your 
transparent object (the most simple solution is a colored background) so be 
sure that it's not working.

A screenshot can tell a lot. :)

Also a description of you setup (OS, gpu and other hardware, ...) and also 
which drivers you're using is very helpfull


Greets
Thomas



On Thu, September 20, 2012 05:45:13 PM Satya Praveen Ganapathi wrote:
> The example which you have sent is working only till the animation
> completes.
> 
> 
> 
> When I use QtQuick2.0 in the example shared without any animation, the
> blending doesnot works and the total .png is black in color.
> 
> 
> 
> Could you please let me know how to fix this issue in QtQuick3D.
> 
> 
> 
> Br,
> 
> Satya
> 
> 
> 
> From: Satya Praveen Ganapathi
> Sent: Thursday, September 20, 2012 4:20 PM
> To: Thomas Senyk
> Cc: Ramakanthreddy_Kesireddy; interest at qt-project.org
> Subject: RE: [Interest] Quick3D mapping of png textures onto Item 3D
> 
> 
> 
> Hi,
> 
> 
> 
> Thanks for the reply.
> 
> Actually we donot have mesh for the png files..so we need to use 3D
> Items predefined(like Quad,Cylnder etc).
> 
> I suppose there is no inbuilt 3D rectangle item.
> 
> 
> 
> Can I use 2.0 instead of 1.0 in the cube example that you shared?
> 
> 
> 
> import QtQuick 1.0
> import Qt3D 1.0
> import Qt3D.Shapes 1.0
> 
> 
> 
> Regards,
> 
> Satya
> 
> ________________________________
> 
> From: Thomas Senyk [mailto:thomas.senyk at pelagicore.com]
> Sent: Thu 9/20/2012 2:52 PM
> To: Satya Praveen Ganapathi
> Cc: Ramakanthreddy_Kesireddy; interest at qt-project.org
> Subject: Re: [Interest] Quick3D mapping of png textures onto Item 3D
> 
> 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: screenshot.png
Type: image/png
Size: 41597 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120920/4e181e48/attachment.png>


More information about the Interest mailing list