Results 1 to 2 of 2

Thread: Differences in miColor between mental ray 3.4 and 3.5 ?

  1. #1
    Join Date
    Sep 2005
    Location
    France
    Posts
    498

    Default Differences in miColor between mental ray 3.4 and 3.5 ?

    Hi,

    I have a strange bug that happens only in mental ray 3.5 for Maya 8, the same code works fine for mental ray for Maya 7.

    In an output shader, I copy a user frame buffer to a buffer of miColor* then I apply some filters on this buffer.
    The user frame buffer copied to the primary frame buffer gives a correct result...
    The pseudo code is :
    Code:
    //ClampD is a clamping function.
    
    void ApplyFilter(const miColor* const _inFB, miColor* const _outFB, int FBWidth, int FBHeight)
    {
    	if &#40;! _inFB || ! _outFB || FBWidth < 0 || FBHeight < 0&#41;
    		return;
    		
    	const miInteger FBWidthMinus1	= FBWidth  - 1;
    	const miInteger FBHeightMinus1	= FBHeight - 1;
    	
    	for &#40;int y=0; y <FBHeight ; ++y&#41; 
    	&#123;
    		for &#40;int x=0; x<FBWidth; ++x&#41; 
    		&#123;
    			const int CurPos				= x	+ &#40;y* FBWidth&#41;;
    			//Center = x, y
    			const miInteger XPixelRight		= ClampD&#40;x + 1, 0, FBWidthMinus1&#41;;
    			const miInteger XPixelLeft		= ClampD&#40;x - 1, 0, FBWidthMinus1&#41;;
    			const miInteger YPixelUp		= ClampD&#40;y - 1, 0, FBHeightMinus1&#41;;
    			const miInteger YPixelDown		= ClampD&#40;y + 1, 0, FBHeightMinus1&#41;;
    	
    			const miColor& Center			= _inFB&#91;CurPos&#93;;
    			const miColor& Right			= _inFB&#91;XPixelRight + &#40;y 			* FBWidth&#41;&#93;;
    			const miColor& Left				= _inFB&#91;XPixelLeft  + &#40;y 			* FBWidth&#41;&#93;;
    			const miColor& Up				= _inFB&#91;x			+ &#40;YPixelUp		* FBWidth&#41;&#93;;
    			const miColor& Down				= _inFB&#91;x			+ &#40;YPixelDown	* FBWidth&#41;&#93;;
    			
    			_outFB&#91;CurPos&#93;&#46;r				= 4*Center&#46;r - Right&#46;r - Left&#46;r - Up&#46;r - Down&#46;r;
    			_outFB&#91;CurPos&#93;&#46;g				= 4*Center&#46;g - Right&#46;g - Left&#46;g - Up&#46;g - Down&#46;g;
    			_outFB&#91;CurPos&#93;&#46;b				= 4*Center&#46;b - Right&#46;b - Left&#46;b - Up&#46;b - Down&#46;b;
    			
    			//Transform in grey level
    			miScalar Grey	= &#40;_outFB&#91;CurPos&#93;&#46;r+ _outFB&#91;CurPos&#93;&#46;g+_outFB&#91;CurPos&#93;&#46;b&#41; / 3&#46;0f;
    			Grey			= ClampD&#40;Grey,0&#46;f, 1&#46;f&#41;;
    			
    			_outFB&#91;CurPos&#93;&#46;r = _outFB&#91;CurPos&#93;&#46;g = _outFB&#91;CurPos&#93;&#46;b = Grey;
    			_outFB&#91;CurPos&#93;&#46;a = 1&#46;0f;
    		&#125;
    	&#125;
    &#125;
    Does anyone see a reason why this would not work with mray for Maya 8 ?
    There doesn't seem to have changes in miColor and moreover I am not using any function from mental ray in this code...

    Thank you.
    Regards,
    David Lanier
    R&D, plugins & shaders development company
    http://www.dl3d.com

  2. #2
    Join Date
    Sep 2005
    Location
    France
    Posts
    498

    Default

    I've found that this partly comes from the dither option of the primary frame buffer as my image comes from the primary frame buffer.
    David Lanier
    R&D, plugins & shaders development company
    http://www.dl3d.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •