Sprite Masking
by Jared Wheeler · in Torque Game Builder · 06/16/2006 (12:39 pm) · 21 replies
I'm about to get started on a project and would love to use TGB for it. Before I part with my 100 bucks though, I wanted to know if TGB supports any kind of masking in its sprite engine. If so, how is it used? If not, what should I use? Do I have to move up to TGE to do this? Does TGE have the sprite engine from TGB built-in?
Thanks!
Jared
Thanks!
Jared
#2
06/16/2006 (1:45 pm)
Makes sense. Thanks for the speedy response. I'm switching over from Flash where you can define the points of an arbitrary polygon then apply that as a mask to some other image at runtime. Anything like that going on in TGB?
#3
06/16/2006 (3:06 pm)
No, nothing like that. Some more masking options would be handy though.
#4
06/16/2006 (3:43 pm)
However there is a full set of OpenGL blending ops, which you can do some nifty stuff with Alpha channels & colors, if you can wrap your mind around it. See this thread & a little demo I wrote www.garagegames.com/mg/forums/result.thread.php?qt=34390
#5
Download windows installer
mindlube.com/garagegames-forum/t2d-blending-demo-setup.exe
Let me know if anyone wants a .zip file instead for mac or linux
06/16/2006 (3:47 pm)
Oops, this is the public forums: Download windows installer
mindlube.com/garagegames-forum/t2d-blending-demo-setup.exe
Let me know if anyone wants a .zip file instead for mac or linux
#7
06/16/2006 (4:37 pm)
OK Matt no problem- I will test it out with RC3, the will put project in a .zip file so you can download it and just copy into your TorqueGamebuilder folder. It should run the same on a Mac & Linus as on Windows.
#8
I converted it to work with TGB 1.1 RC3 & re worked the thing in the level builder. I zipped up the project directory, so you will need TGB RC3 or newer to try this. It should work on Mac and Linux the same way.
mindlube.com/garagegames-forum/TGBBlendingDemo.zip
Download this file and unzip
Copy folder TGBBlendingDemo into Torque Game Builder/games directory (alongside other projects)
Launch TGB.exe
File > Open Project > TGBBlendingDemo
File > OPen Level > TGBBlendingDemo> Data > Levels > demo.t2d (if necessary)
F5- to run level
Good luck!
06/17/2006 (12:53 am)
Re: the blending demo. The old url mindlube.com/garagegames-forum/t2d-blending-demo-setup.exe has the Windows executable for T2d 1.0.2, so if you are on Windows, that's easiest. I converted it to work with TGB 1.1 RC3 & re worked the thing in the level builder. I zipped up the project directory, so you will need TGB RC3 or newer to try this. It should work on Mac and Linux the same way.
mindlube.com/garagegames-forum/TGBBlendingDemo.zip
Download this file and unzip
Copy folder TGBBlendingDemo into Torque Game Builder/games directory (alongside other projects)
Launch TGB.exe
File > Open Project > TGBBlendingDemo
File > OPen Level > TGBBlendingDemo> Data > Levels > demo.t2d (if necessary)
F5- to run level
Good luck!
#9
06/17/2006 (12:56 am)
Alex, you do know you're not supposed to be making TGB scripts publically available?
#10
06/17/2006 (1:18 am)
Philip, yes I have read the EULA. In the .zip there are only 4 .cs files and 1 .gui file [edit- and a couple of t2d files] You can see more Torquescript code by going to a bookstore and looking at the Game Development aisle. If someone from Garagegames advises me to, I will rename the .zip file and post the new URL in the private forums.
#11
06/17/2006 (1:31 am)
Why not just deliver the script compiled only? (maybe you do that - I have not had a look at the tool lately)
#12
06/17/2006 (1:44 am)
The posting of TorqueScript is fine. It's the posting of TGB specific code (which your source files include) that's prohibited by the EULA.
#13
@Philip, I appreciate your concern & strictness. For the record, I forgot (again) this was the public forum when I posted that link. And if GG asks me to take it down I will.
06/17/2006 (2:01 am)
@Michael, are .dso cross-platform? I don't know- I'm asking. But also it's helpful for one to see the calls to set the GL blending parameters in script if you aren't sure how to do it.@Philip, I appreciate your concern & strictness. For the record, I forgot (again) this was the public forum when I posted that link. And if GG asks me to take it down I will.
#14
06/17/2006 (2:12 am)
Yes, I suppose .dso is cross-platform (but I have not tried yet).
#15
06/17/2006 (2:17 am)
To Jared's original question though: the OpenGL blending stuff is interesting - and there are many different combinations of the parameters. If the goal is to take image B and make it the alpha mask for image A- I haven't figured out how to do it with the GL blending. But I still think it must be possible, somehow.
#16
06/17/2006 (2:17 am)
Or like Philip said, just use .PNG format w/ alpha channel :-)
#17
06/17/2006 (2:34 am)
When I posted one of my game demos, a Mac user just took my .dso files and ran them against the Mac version of TGB and it all worked fine :)
#18
06/17/2006 (7:44 pm)
Thanks Alex. Actually, the ultimate goal is to use coordinates generated at runtime to draw polygon A and use that shape to mask image B. And be able to change the shape of polygon A every frame. From the noises made so far though, that doesn't sound possible. Drag.
#19
This isn't stock functionality I'm afraid though, sorry.
- Melv.
06/18/2006 (2:10 pm)
The real answer is that TGB is essentially a raster engine, not a vector engine. Of course, the great thing about TGB is that you can purchase the whole of the codebase and generate stuff like this yourself.This isn't stock functionality I'm afraid though, sorry.
- Melv.
#20
06/19/2006 (2:46 pm)
@Jared- yep sounds like it. Not a drag though- you would be surprised at what you can accomplish with animated sprites, particle effects and the openGL blending options. And like Melv says- anything is possible because without much expense you can license the source for Torque. Someone even wrote a Vector Shapes resource they were using to write their own GUI toolkit with TGB. Howevr the best way to approach TGB is to say "OK it allows me to (a,b,c...z) cool things so what kind of games can I make with that?" At least that's how I am approaching it.
Torque Owner Philip Mansfield
Default Studio Name
And no, TGE does not include the stuff from TGB. TGB shares a number of TGEs components, and if you buy both you can add the source together to get TGB running inside of TGE.