Results 1 to 3 of 3

Thread: Compiling 'texture arithmetic expressions'

  1. #1
    Senior Member Regular Contributor
    Join Date
    Sep 2000
    Location
    France
    Posts
    185

    Compiling 'texture arithmetic expressions'

    Hi everyone,

    I was wondering if anyone has pointers on some work about low level & minimal & practical & efficient 'shader'
    compilation.

    What I was thinking about is to play with C++ feature to achieve some kind of neat & readable C++ writing of a
    multitexture expression (only including unextended OpenGL (plus ARB_multitexture) features for the moment.

    In my first toughts, it would have looked like

    Code :
    GLexpression e = color[ color_array ] * texture2d[ uv_id ] * texture2d[ uv_id2 ] + texture_2d[ texGen ];
    	e->render(object);
    The expression would be able to optimally assign multitexturing units according to the number available, and
    eventually do multipass on the expression if there is not enough texture units.

    I dropped that syntax because of the operator priorities (* > +) and the like. So I came to something like:

    Code :
    GLexpression e = color[ color_array ].mul( texture2d[ uv_id ]).mul( texture2d[ uv_id2 ] ).add( texture_2d[ texGen ] );
    	e->render(object);
    that takes into account the linear application of textures. However I'm not glad since if I run out of texture units,
    I don't have good means to apply the rest of my expression using multitexturing. It's easy to apply the rest in multi-pass
    with mono-texture. Multitexturing needs to take commutativity and the like in account!

    So I'm finally wondering if all this if worth the effort !? Has anyone of you played with this kind of logic ?
    What were your results ?

    thanks
    Nicolas.

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Feb 2000
    Location
    San Diego, CA, USA
    Posts
    604

    Re: Compiling 'texture arithmetic expressions'

    What you want has already been done, to a greater extent, by a group at Stanford. Check out this link:
    http://graphics.stanford.edu/projects/shading/

    -- Zeno

  3. #3
    Senior Member Regular Contributor
    Join Date
    Sep 2000
    Location
    France
    Posts
    185

    Re: Compiling 'texture arithmetic expressions'

    Thanx Zeno, I was aware of this project and of a few others (I can't find the links here...).

    But these projects are far too ambitious for my actual needs, and, moreover, I'm a kind of 'make-it-yourself' man. So I'm looking for technical data and experience more than for a pre-cooked lib to use

    Any other pointer of experience ?

Similar Threads

  1. Problem with boolean expressions
    By danielkr in forum OpenGL: GLSL
    Replies: 5
    Last Post: 11-30-2012, 04:08 PM
  2. Arbitrary-precision arithmetic
    By BratSinot in forum OpenCL
    Replies: 3
    Last Post: 12-15-2011, 11:44 PM
  3. conditional expressions and division by 0
    By James W. Walker in forum OpenGL: GLSL
    Replies: 4
    Last Post: 02-20-2008, 03:58 PM
  4. calculate index expressions at run-time?
    By Jennis in forum OpenGL: GLSL
    Replies: 1
    Last Post: 10-26-2005, 06:42 AM
  5. Polygon trianglize arithmetic?
    By Golden in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 12-19-2002, 12:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean