Discussion:
Help for shader filter for data with wrap around in L8 texture
(too old to reply)
Jens Pedersen
2008-10-30 07:52:06 UTC
Permalink
Hi
I have some data captured from experiments in a L8 texture that should be
shown in a 2D image.
Now my problem is that the data some places wrap around, so a high value is
close to a low value. In that case I want a sharp transition in the final
image, otherwise I want a soft image where data are smeared out to some
degree.
The shader must run on a platform with no ddx or ddy shader instructions and
no pyramidal interpolation. Only point and linear interpolation can be used.

I am kind of stuck with this problem. Any ideas please?
Or a link to good places to look.
--
Jens
BK Medical
Jan Bruns
2008-10-30 08:53:13 UTC
Permalink
Post by Jens Pedersen
I have some data captured from experiments in a L8 texture that should be
shown in a 2D image.
Now my problem is that the data some places wrap around, so a high value is
close to a low value. In that case I want a sharp transition in the final
image, otherwise I want a soft image where data are smeared out to some
degree.
The shader must run on a platform with no ddx or ddy shader instructions and
no pyramidal interpolation. Only point and linear interpolation can be used.
I am kind of stuck with this problem. Any ideas please?
Or a link to good places to look.
Why can't mipmaps be used? Lack of hardware support or some technical reason?

Anyway, here's what I would probably do to achieve what you described:

1. a wrap-edge-detection pass, storing 1.0 to mean "smoothable"
2. weighted blur, by
a) summing up the desired L8 (optionally using an arbitrary weighting function f)
b) summing up output of pass1 (same function f)
c) if this pixel isn't smoothable, put out thispixel.L8
else put out a/b

Gruss

Jan Bruns
Jan Bruns
2008-10-31 09:34:04 UTC
Permalink
Post by Jan Bruns
Post by Jens Pedersen
I have some data captured from experiments in a L8 texture that should be
shown in a 2D image.
Now my problem is that the data some places wrap around, so a high value is
close to a low value. In that case I want a sharp transition in the final
image, otherwise I want a soft image where data are smeared out to some
degree.
The shader must run on a platform with no ddx or ddy shader instructions and
no pyramidal interpolation. Only point and linear interpolation can be used.
I am kind of stuck with this problem. Any ideas please?
Or a link to good places to look.
Why can't mipmaps be used? Lack of hardware support or some technical reason?
1. a wrap-edge-detection pass, storing 1.0 to mean "smoothable"
2. weighted blur, by
a) summing up the desired L8 (optionally using an arbitrary weighting function f)
b) summing up output of pass1 (same function f)
c) if this pixel isn't smoothable, put out thispixel.L8
else put out a/b
Sorry, forgot to mention the trick about step 2a):
Use the L8-Texure values multiplied by the smoothable-value.


In other words, say there is a texture L with the experiment-data,
and a texture S containing the smoothable-indicator, the forumla of
the above method is:

tmp = sum( sum( L[x+dx, y+dy] * S[x+dx, y+dy] * f(dx, dy), dx=a..b), dy=a..b)
/ sum( sum( S[x+dx, y+dy] * f(dx, dy), dx=a..b), dy=a..b)

result = ( S[x,y] >0) ? tmp : L[x,y];

This blurs only where enabled, and doesn't take "disabled" neighbors into account
(let a=-1 and b=1, if S has small edges ).

Gruss

Jan Bruns
WenJun Zhang[msft]
2008-11-05 09:44:06 UTC
Permalink
Hi Jens,

Jan has provided some perfect suggestions. Just wonder if you have any
further questions on this topic?

Have a great day.

Sincerely,

WenJun Zhang

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
***@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

MSDN Managed Newsgroup support offering is for non-urgent issues where an
initial response from the community or a Microsoft Support Engineer within
2 business day is acceptable. Please note that each follow up response may
take approximately 2 business days as the support professional working with
you may need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations that require urgent,
real-time or phone-based interactions. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Jan Bruns
2008-11-06 04:40:14 UTC
Permalink
Nice to hear someone was able to decipher my explainations. Thanks.

Gruss

Jan Bruns
Post by WenJun Zhang[msft]
Jan has provided some perfect suggestions. Just wonder if you have any
further questions on this topic?
Have a great day.
Sincerely,
WenJun Zhang
Microsoft Online Community Support
Loading...