About those shaders. Have you actually tried to use the switching mechanism? Since I gues switching in shaders won't make it much faster(rather slower). And another problem, how do I need to set those uniform variables for a whole model, using VBO's? I gues that's not possible, so I would almost need to make a VBO per mesh(or use that instancing).

Since i'm trying to make a game, I gues I don't have a real need for specular and diffuse color.  I gues just goodlooking textures would be fine. But if you still have some ideas, please let me know.

Hylke


From:  Gernot Ziegler <[EMAIL PROTECTED]>
Reply-To:  [email protected]
To:  [email protected]
Subject:  Re: [Lib3ds-devel] Materials
Date:  Thu, 18 May 2006 14:05:54 +0200 (MEST)
MIME-Version:  1.0
Received:  from lists-outbound.sourceforge.net ([66.35.250.225]) by bay0-mc8-f8.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 18 May 2006 05:06:01 -0700
Received:  from sc8-sf-list1-b.sourceforge.net (sc8-sf-list1-b.sourceforge.net [10.3.1.7])by sc8-sf-spam1.sourceforge.net (Postfix) with ESMTPid B6DD18967D; Thu, 18 May 2006 05:06:01 -0700 (PDT)
Received:  from [10.3.1.93] (helo=sc8-sf-list1-new.sourceforge.net)by sc8-sf-list1.sourceforge.net with esmtp (Exim 4.30)id 1FghGQ-0001Ur-TXfor [email protected]; Thu, 18 May 2006 05:05:58 -0700
Received:  from sc8-sf-mx2-b.sourceforge.net ([10.3.1.92] helo=mail.sourceforge.net)by sc8-sf-list1-new.sourceforge.net with esmtp (Exim 4.43)id 1FghGQ-000889-V0for [email protected]; Thu, 18 May 2006 05:05:58 -0700
Received:  from mail.lysator.liu.se ([130.236.254.3])by mail.sourceforge.net with esmtps (TLSv1:AES256-SHA:256)(Exim 4.44)id 1FghGQ-00026G-0Cfor [email protected]; Thu, 18 May 2006 05:05:58 -0700
Received:  from localhost (localhost.localdomain [127.0.0.1])by mail.lysator.liu.se (Postfix) with ESMTP id 43348200A1E6for <[email protected]>; Thu, 18 May 2006 14:05:56 +0200 (CEST)
Received:  from mail.lysator.liu.se ([127.0.0.1])by localhost (lenin.lysator.liu.se [127.0.0.1]) (amavisd-new, port 10024)with LMTP id 13391-01-4 for <[email protected]>;Thu, 18 May 2006 14:05:54 +0200 (CEST)
Received:  from tokaimura.lysator.liu.se (tokaimura.lysator.liu.se [130.236.254.102])(using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits))(No client certificate requested)by mail.lysator.liu.se (Postfix) with ESMTP id AB438200A1E1for <[email protected]>; Thu, 18 May 2006 14:05:54 +0200 (CEST)
Hej Hylke !

> > > Is it possible for a sinle face to have materials, while all the other
> > > materials don't?
> >While all the other _faces_ don't, you mean ?
> >If you look into player.c, you see that every face might introduce a
> >material change.
> Yeah, that's what I meant. Sorry, I should have reread my e-mail before
> sending :-)
Nono, it's ok - I was just a bit cranky that day, didn't use a lot of
smileys :-)

> >For efficient representation in a VBO, you would need to group all the
> >faces/triangles that have a common material, and upload them at once.
> But let's say, you have a model which is a charachter(-> human or whatever),
> who consists of multiple textures(8 or so), one for the skin, one for the
> head, one for the suit and so on.
> Wouldn't it be faster to just create one big texture, and adjust the texture
> coordinates to match the right texture? Because OpenGL 2.0 now supports
> non-power of 2 textures, so I could make one big texture, with each texture
> to the right of the other.
Sure, you can do that, and that's what e.g. Cal3D ( cal3d.sf.net )
uses for its models -
it is just a tradeoff between having to touch the texture coordinates on
the CPU (repositioning all the coordinates), and doing a texture switch, which
is not that expensive anymore, I think.

> >Besides, materials as an OpenGL concept are obsolete by now anyways, so
> >when you already use VBOs, you might want to switch to shaders, too. That
> >way, you could provide material parameters as an extra data channel, and
> >thus upload all parameters at once.
> I've read the first couple of chapters of my OpenGL orange
> book(unfortuneatly I don't have time to read it any further now :'( ), but I
> don't see how this can help me with my material applying(I don't completly
> understand the last sentence).
Forget what I wrote before; that was an assumption from Cg (a
near-to-obsolete shader programming language), where material properties
where not accessible from inside the shader.

Material properties basically boil down to diffuse and specular color
calculations in the vertex shader.
For more advanced material properties, like anisotropic specular
effects, you will need to upload more parameters than the "classic
material properties". That is done with so called uniform variables.

So, to keep things consistent, and not to mix the old-fashioned
OpenGL material properties with some extra uniform variables, one could
represent all the material setup with uniform variables, and switch shader
after the material property that the current 3DS material imposes.

Heck, it would even be possible to specify _a shader file_ as a file name,
making arbitrary material shading possible (see CgFX), but I am
disgressing, and probably pushing the good ol' 3DS format a bit too far ;)
( COLLADA can handle such things, much more modern solution ).

> Looks cool, but it's not explained very well in the presentation(the
> functions are giving the idea that it's only for non-changing objects, while
> in the begining they say you can change color and matrix transformations).
Well, basically, while some of the data channel are re-read repeatedly,
others only increase once for every iteration. That is how some data
channels can hold instance-specific data like transformation or color
changes.

I had been writing up my previous mail in a bit of a hurry, so my ideas
were not that well-carved - but that topic is interesting to me, so dont
hesitate to bring new things up once in a while :-)

Servus,
   Gernot

--
T----------------------------W-E-L-C-O-M-E------------------------------T
O  The Austria <=> Sweden <=> Germany <=> Netherlands connection.....   H
|  http://www.mpi-sb.mpg.de/~gziegler | http://www.lysator.liu.se/~gz   E
\-----------------------------F-U-T-U-R-E-------------------------------/


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
lib3ds-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lib3ds-devel
------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ lib3ds-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/lib3ds-devel

Reply via email to