Jens Posted November 21, 2006 Share Posted November 21, 2006 I have the following problem: In a VEX shader I have a fairly complex formula and rather then evaluating it each time I'd like to use a lookup table. As far as I know VEX won't allow us to to create an array containing ~500 entries. There are currently two solutions I came up with though I don't like either one much. i) Store a few values and use something like a spline interpolation (much slower then a lookup, though still more effecient then evaluating the 'big' formla) ii) Using 4x4 matrices and building something like a binary tree with 'if - instructions' (fairly fast, but takes time to implement / time to write a small tool to automate it) I don't like either solution much and wonder if anyone has come up with a smarter solution. Jens Quote Link to comment Share on other sites More sharing options...
crunch Posted November 21, 2006 Share Posted November 21, 2006 I have the following problem: In a VEX shader I have a fairly complex formula and rather then evaluating it each time I'd like to use a lookup table. As far as I know VEX won't allow us to to create an array containing ~500 entries.There are currently two solutions I came up with though I don't like either one much. i) Store a few values and use something like a spline interpolation (much slower then a lookup, though still more effecient then evaluating the 'big' formla) ii) Using 4x4 matrices and building something like a binary tree with 'if - instructions' (fairly fast, but takes time to implement / time to write a small tool to automate it) I don't like either solution much and wonder if anyone has come up with a smarter solution. Jens A texture map? Quote Link to comment Share on other sites More sharing options...
sibarrick Posted November 21, 2006 Share Posted November 21, 2006 A point cloud? Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted November 21, 2006 Share Posted November 21, 2006 A DSO? ... if we assume that the "big formula" is complex enough that it's no longer just a matter of hallucinating a way to store its static data in VEX but also of accessing it efficiently... Might as well do yer fancy binary/red-black/K-d/whatever storage along with all the number crunching over in C++ land, no? If it's big/complex enough, then whatever overhead calling the dso might incur should become negligible by comparison (i.e: it should perform the fastest). Quote Link to comment Share on other sites More sharing options...
Jens Posted November 23, 2006 Author Share Posted November 23, 2006 All solutions seem fine, thanks for the input. I want to keep everything with VEX if possible and I like the idea using a texture to store the values most (basically I'm most familiar with that ). However I have one problem.. getting the data into the texture. Is there a simple way to create a texture from data assuming I have created the appropriate r,g,b values to represent the data and have it in a text file? Like a two-liner with hscript ? Writing a small program for that with java wouldn't be that much of an effort.. but if I can avoid it, all the better. Quote Link to comment Share on other sites More sharing options...
edward Posted November 24, 2006 Share Posted November 24, 2006 Pixel COP? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.