On 17 Mar 2010, at 13:19, Chris Wood wrote:

There we go, problem solved :) Good stuff Alex.

Cheers. It's something I've used before for a few different things.

I guess for more complex cases, you've got RGBA values to store your
x/y offsets and scales. You'd just have to watch the accuracy - are
the gl_Color values 8 bit?

I'm guessing yes. I'd like to get a definitive answer on that one though. I notice the possibly values on the RGB color picker sliders go from 1 > 255, which seems to suggest 8-bit.


It could get nasty if you're using a few large textures, or if you're
using a bunch of animated image sources though. If that's the case,
try my approach, otherwise stick with Alex's image dictionary.

Definitely. My approach probably doesn't scale particularly well (in number or size-of-texture terms), but for simple cases where you have a small number of smallish textures, it's a simple method that works fine.

a|x




Chris


On 17 March 2010 13:01, Alex Drinkwater <[email protected]> wrote:
OK, this works.

There's a GLSL shader with 4x Sprite patches inside it.
Each Sprite has a different value for the Red channel of it's Color input. The Red channel is read in the Vertex Shader from gl_Color. That value is
used to offset the texture coordinates on the X-axis.
I also had to scale the X-axis texture coordinates so that they only covered
1/4 of the width of the texture (since it was a strip of 4 different
graphics in a horizontal row). The logic would be a bit more complex for a sheet of different textures arranged in a grid, rather than a strip, but the principle would be the same, except you'd need to scale and offset on both
X and Y axes.



alx







On 17 Mar 2010, at 10:06, Chris Wood wrote:

Just to be clear, you can have one shader applied to multiple objects
but it will apply the same texture/effect/whatever to every object.
Fine if you want say lighting applied to everything, but not if you
want separate textures.

One solution: give each object a unique colour, and use the colour to
select a texture from an array by index.

Chris

On 17 March 2010 09:51, thomas pachoud <[email protected]> wrote:

Hi,
not 100% sure, but I don't think you can use one single GLSL for multiple objects. You should use one GLSL applied to each objects. In this way,
each
objects will apply the same GLSL with his textures and 3D positionning
and
lighting information. And if you need to act on full scene, you should
add
one GLSL at the end of your pipeline, playing on your 2D final rendering.
On Tue, Mar 16, 2010 at 9:35 AM, George Toledo <[email protected]>
wrote:

I may be wrong, but I don't believe that is possible in QC. What you
would
need to do is use a separate shader for each object. GLSL in QC does
support
multiple textures, but I don't think one can assign them to arbitrary
objects in the scene.
I'm curious about this as well... I've successfully used GLSL in QC to send many different image sources to a shader, and to use the shader to
crop, translate and dissolve, but that is in the context of a 2D
surface.
Is there a downside to putting each object in a separate GLSL macro, and
using distinct textures for each in your scenario? You can always
connect
the join the lighting of each (or any other parameter) with insert
splitters, so your multiple shaders can look cohesive in the scene when
you
move a light source (or whatever).
-George Toledo

On Mon, Mar 15, 2010 at 7:11 AM, luca palmili <[email protected]>
wrote:

Hi to all,
my scene is composed by N objects (o1, o2..., oN), each of them has got
one different texture (t1, t2, ..., tN). How can I render all the
objects in
a single GLSL shader? I mean: if I pass my N texture as uniform
parameters
to the GLSL shader, how can I tell to the GLSL shader to use texture_1
for
object_1, texture_2 for object_2, etc...?
Thank you!

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list
 ([email protected])
Help/Unsubscribe/Update your Subscription:


http://lists.apple.com/mailman/options/quartzcomposer-dev/ gtoledo3%40gmail.com

This email sent to [email protected]


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list
 ([email protected])
Help/Unsubscribe/Update your Subscription:


http://lists.apple.com/mailman/options/quartzcomposer-dev/ thomas.pachoud%40gmail.com

This email sent to [email protected]



--
Thomas Pachoud
ingénieur multimédia IMAC
www.creapach.fr

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list (Quartzcomposer- [email protected])
Help/Unsubscribe/Update your Subscription:

http://lists.apple.com/mailman/options/quartzcomposer-dev/psonice %40gmail.com

This email sent to [email protected]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list (Quartzcomposer- [email protected])
Help/Unsubscribe/Update your Subscription:

http://lists.apple.com/mailman/options/quartzcomposer-dev/ the_voder%40yahoo.co.uk

This email sent to [email protected]




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to