View Full Version : Bitmap Transform
12-03-2008, 12:03 PM
I have 2 little questions about bitmap transform.
Is it possible to desaturate a bitmap by MaxScript ?
Is it possible to blur a bitmap by MaxScript ?
It's because i use a script to make a virtual viewport, and i render my actual viewport as a bitmap to it, and i want to see it in greyscale or blured (for lighting is cool to have this vision).
12-03-2008, 12:38 PM
are you using max 2008 or up? you can just use a color correction map in the environment map slot. you can perform many image adjustments and this will show up in vpt background.
12-03-2008, 12:40 PM
i'm using max 9....
That isn't for render but for realtime. I'm using directX shader with vertexColor in my scene.
Here is the script i'm using for duplicate my viewport :
rollout t "Virtual viewport" width:200 height:200
bitmap w "" width:200 height:200
fn virtualViewport =
w.bitMap = gw.getViewportDib()
--colors = getPixels w.bitmap [0,0] 200
on t open do
on t close do
on t resized size do
x = gw.getWinSizeX()
y = gw.getWinSizeY()
w.width = size.x
w.height = size.y
if size.x > x do
t.width = x
w.width = x
if size.y > y do
t.height = y
w.height = y
createDialog t style:#(#style_resizing,#style_minimizebox,#style_titlebar,#style_border,#style_sysmenu)
12-05-2008, 03:59 PM
Do you mean something like this?:
(0.3*pixelVal.x + 0.59*pixelVal.y + 0.11*pixelVal.z)
That will return a pixel's luma value. So just assign that value to pixelVal.x, pixelVal.y, and pixelVal.z and you've got a grayscale. Since you're doing this to a bitmap, remember to read entire rows of pixels at a time, as it is more than twice as quick as doing it one pixel at a time.
As for blurring, I'd assume some research on convolution algorithms would get you what you need.
To do it in realtime, you would have to use Viewport shaders (scene shaders).
Max does support them, though they are poorly documented and don't always work.
But blurring and desaturate should be possible.
12-05-2008, 07:38 PM
Thanks for reply
I will try that handiklap
knees: what is scene shaders ?
12-05-2008, 07:49 PM
Utilities > More... > Scene Effect Loader.
This allows you to load DirectX Scene Effects, that effect the whole viewport. Max ships with a few samples to do various effects (\maps\fx\scene\).
12-05-2008, 07:49 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.