Hi Brian, Thank you very much, it stopped crashing and it handles channels correctly.
But it still doesn't do what it is supposed to, just some weird vertical distortions (taking the depth into account). I think I need the help of a maths guru now. The guy that created the dilate node should have left his email somewhere :) Ben On Fri, Oct 24, 2014 at 8:41 PM, Brian Hawkins <[email protected]> wrote: > If you use Mask_All in your request(), > input0().request(x,y,r,t,Mask_all,count) then it will read all of the > available channels from the input. If the depth.z channel exists in your > input then using Mask_All in your request function will load the depth > data. > > > > In the engine call “channels” is equal to your set_out_channels() in your > validate() function. If you set_out_channels(Mask_RGB) then the engine will > use Mask_RGB for channels. Then when you use foreach(z,channels) the engine > will only cycle through RGB even though there may be additional channels > available for access. So you can access the depth information, but when > using foreach(z,channels) the engine will not include any modifications to > the depth information. > > > > If you still want to pass through the depth information (ie > set_out_channels(Mask_All)) you can always include a check in the foreach > loop, something like if (z == Chan_Z){ [copy input to output] } > > > > In your engine you would create a row and fill it with the depth > information: > > Row d(x,r) > > d.get(input0(),y,x,r,Mask_Z) //fills row with Mask_Z (depth.Z channel) > > > > You can then get the depth value for each pixel X with: > > float depth = d[Chan_Z][x] > > > > Once you have the depth value you can use it as your tile search size in > v_pass (obviously you’ll have to modify v_pass function slightly) to be > equal to the depth for each pixel. It might help to create a full frame > tile and pass it to the v_pass function as well so that you only create one > big tile for all pixels as opposed to one small tile for every pixel. Then > you can use the same depth value on your x pass. If you want a separable x > and y size you’ll need to set up some sort of depth scalar value for each > axis. > > > > Disclaimer: BTW I haven’t compiled any of this so no guarantees on the > syntax being exactly correct, but hopefully you’ll get the idea. > > > > *From:* [email protected] [mailto: > [email protected]] *On Behalf Of *Benoit Delaunay > *Sent:* Friday, October 24, 2014 10:51 AM > *To:* [email protected] > *Subject:* [Nuke-dev] Dilate a channel according to another channel's > values. > > > > Nukers, hello ! > > > > What I am trying to achieve is a node that would: > > - read the Z channel > > - dilate every channel according to the Z values > > the exact same dilation would be applied to every channel. > > > > What I tried: > > LevelSet then iDilate, not perfectly accurate and too slow. > > VectorGenerator on a 2 frames animation of the original z / dilated z, > > not accurate enough either. > > > > I tried learning C++ and the api but these _request, _get_vpass and > > Row are a bit obscure to me... > > > > I started with the Dilate.cpp source, which has these > > > > foreach (z, channels) { > > const float* FROM = in[z]; > > float* TO = out.writable(z); > > float v = FROM[x + h_size]; > > > > I added this before this loop > > > > const float* FROMz = in[channel]; > > float* TOz = out.writable(channel); > > float vz = FROMz[x + s_size]; > > > > 'channel' being the depth.z channel of the same input. > > Then obviously I have to remove channel from channels > > and try to delay computing TOz until I had dilated every other channel > > > > if (z == c1.last()) > > > > First problem: I don't know exactly how to use this z channel and add it > > to the 'requested rows', using it's values without actually altering them. > > Maybe I could store the values somewhere else ? > > I need the original values for each channel but I need the altered values > > because the dilate.cpp modifies all these TO values twice > > Second problem : a while loop prevents me from just using this .last() > check. > > I tried to remove this foreach (z, channels) loop by defining separate > > variables for the r, g and b channels and now it crashes instantly. > > Third problem : Am I even on the right track ? > > > > Mayday ! > > > > Cheers > > > > Benoit > > > ------------------------------ > > > > ****************************************************************************************** > This email and any files transmitted with it are confidential and intended > solely for the use of the individual or entity to whom they are addressed > and may contain confidential and privileged information. No one else is > authorized to distribute, forward, print, copy or act upon any information > contained in this email. If you are not the intended recipient, please > contact the sender by reply email and destroy all copies of the original > message. > > ******************************************************************************************* > > ------------------------------ > > > ****************************************************************************************** > This email and any files transmitted with it are confidential and intended > solely for the use of the individual or entity to whom they are addressed > and may contain confidential and privileged information. No one else is > authorized to distribute, forward, print, copy or act upon any information > contained in this email. If you are not the intended recipient, please > contact the sender by reply email and destroy all copies of the original > message. > > ******************************************************************************************* > > _______________________________________________ > Nuke-dev mailing list > [email protected], http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev > > -- http://www.bendelaunay.com/
_______________________________________________ Nuke-dev mailing list [email protected], http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev
