[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4505: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3706)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4507: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3706)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4508: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3706)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4509: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3706)
RabidHaMsTeR.Org • View topic - Subtracting textures?

Subtracting textures?

How to create a custom scene, and custom scenes people have created.

Moderators: rabidhamster, Rovastar

Subtracting textures?

Postby Jussi » Sun Mar 20, 2005 4:08 pm

I've been trying to implement an oscillating dynamical system for a texture surface. However, I have a problem I have failed to solve so far. I need to calculate a subtraction operation with texture surfaces, and I have not yet found a way to do this.

In other words, if a color for pixel (i,j) in textures A and B are denoted cA and cB, I want to carry out the opreation
cC = cA - cB
for the whole texture. The structure of the system guarantees that cA > cB and thus cC > 0.

The only way I have come up with to get a minus sign is to take an inverse: cB -> 1-cB. However, it doesn't help, as
cc = cA - cB = cA + (1-cB) - 1
as now the minus sign is in front of 1.

Does someone know how it would be possible to carry out the texture subtraction? Or is it even possible to do that on hardware?
A universe is something that happens once in a while.
Jussi
 
Posts: 40
Joined: Sat Dec 11, 2004 11:20 am
Location: Turku, Finland

Postby rabidhamster » Sun Mar 20, 2005 6:18 pm

the MIX module will do it, there's an ADDOFFS and SUBOFFS that do a+b-0.5 and a-b-0.5 I think - its how I get the water effect.

Unfortunately it can only be done with register combiners and multitexturing, and I haven't implemented any of that in shaders or 'GL yet so MIX is the only way to get at it.

- Gordon
rabidhamster
Site Admin
 
Posts: 1100
Joined: Fri Mar 21, 2003 12:31 pm
Location: Cambridge, England

Postby Jussi » Mon Mar 21, 2005 8:14 am

A universe is something that happens once in a while.
Jussi
 
Posts: 40
Joined: Sat Dec 11, 2004 11:20 am
Location: Turku, Finland

Postby Jussi » Wed Mar 23, 2005 7:02 pm

Now I got the oscillating system to work on my Matlab test code so that all variables stay on the [0,1] interval. I have not tried it on R4 yet, however, as I realised that the color accuracy might be a problem. :cry:

Are the color channels on the texture surfaces represented as 8-bit integers? If they are, then my great plan will hardly work as the accuracy is not sufficient for recursive calculations. Or is the accuracy dependent on the used display adapter?
A universe is something that happens once in a while.
Jussi
 
Posts: 40
Joined: Sat Dec 11, 2004 11:20 am
Location: Turku, Finland

Postby rabidhamster » Wed Mar 23, 2005 9:09 pm

I believe the textures are 8 bit. Turning on PBuffers may make the accuracy better though. If you can model it in matlab, arrange for it to be from 127 to -128, or as close as you can get it. The video card will clip rather than overflow, so any issues with overflowing won't be too visible. The water effect i've done works just fine in 8 bit - i'm not sure what you're after, but you may find 8 bit is ok.

I think matlab has a function to restrict accuracy - you may find it helpful in modelling.
rabidhamster
Site Admin
 
Posts: 1100
Joined: Fri Mar 21, 2003 12:31 pm
Location: Cambridge, England


Return to R4 Custom Scenes

Who is online

Users browsing this forum: No registered users and 14 guests

cron