Disable Texture Interpolation in Daz Studio?
Hiya,
After about 8 hours of trying everything under the sun, I'm wondering if anybody knows if there's any way to disable texture interpolation (sub pixel positioning blending) in Daz's rendering? (I'm happy to use any inbuilt or cheap/free renderer engine, I'm just trying to render solid colour sections without any bleed into each other)
(There's a screenshot example for the same thing in Blender here)
e.g. How Daz would seem to render a low resolution texture: http://i.imgur.com/gNZroLc.png
How I'd prefer to render it: http://i.imgur.com/f329Pxc.png
(Scaling textures up doesn't help, I still get AA-like pixels between the colour boundaries)
The only two avenues left which seem likely are possibly somehow through the Shader Mixer, or exporting to another renderer (such as Blender), though I tried that with obj and didn't have much luck (and I also need to do this for dozens of renders a month, so would prefer to do it straight from Daz or in a repeatable batchable pipeline).
edit: It's unclear whether this issue is caused by texture interpolation, or UV values which give fractional pixel positions, I'm going to try and explore the second now.
Comments
you can do the exact same thing like in you do in blender with shadermixer; see screenshot.
What is your Shading Rate, in Render Settings>Advanced tab? What are your other render settings?
Thanks so much Millighost, that worked :D (edit: Oops, perhaps not), and I'd have never figured all of that out on my own. (For anybody following up and trying the same thing, I also needed to set the 'value' slider in the live material editor panel to the texture size for the texture to show & to do so cleanly).
For shading rates, I tried both the minimum and maximum Richard, along with just about every possible combination of the render settings. In the end I think that it was just sub-pixel UV mapping leading to the result, which the above crazy graph fixes.
Oops I was wrong sorry, that gives a seemingly-correct pixelated (or single colour) look to face texturing (seemingly colouring them just one single colour), but doesn't stop the bleed effect between different regions of colour on the same material (i.e. there's a blurred AA-like line between two hard colours, which are clear pixelated neighbours in the original material)
e.g. Here's a segment of the original texture - http://i.imgur.com/K9Ad531.png
Here's how it looks when toon mapped when zoomed in - http://i.imgur.com/ZNkqcEi.png
Here's how it looks now (despite the texture coordinates now being hard integers, the blurriness is still there) - http://i.imgur.com/YvFqeoA.png
(The last one was before I fixed the resolution mapping of the texture to the scene, but that made no difference, it just looked like the second image then - The blurriness between colour regions is what I can't fix no matter what I try)
Unfortunately I think that it's a purely Texture Interpolation issue. I've written a software renderer before and actually didn't have any blended texture interpolation myself (because it's somewhat harder to do than just straight up picking a closest pixel colour), so I'd be surprised if there's not a way to disable it in the renderer somehow.
I've tried a few more things, and think that I've narrowed it down to one setting which I need to change, but am unsure how.
This Shader-Builder network boils the down solution so far to its simplest, setting the filter area multiplier to zero.
Going by the advice here which seems to be for general renderman considerations, I've ruled out #1 (the above network), #2 (checked the daz temp folder for mipmaps, they're still cleanly pixelated), and #3 (in both Shader Builder & Shader Mixer, adding s/t multipliers & divisors, as well as adding and subtracting half a pixel position before and after the rounding stage).
It seems that changing the ShadingInterpolation from 'smooth' to 'constant' might help, but currently I can't see how to set such settings. There's a 3Delight/Blender solution here which uses something called Attributes (which I think might be called RiAttributes in Daz?), but I can't see how to work that into (presumably) the Shader Builder script, as some sort of pre-initialisation global state variable. It would be easier if there was a way to just write a RenderMan script directly I think, rather than having to go exclusively through the GUI as seems to be the case, though maybe I can compile one and somehow use it in the graph, which is what I'm looking at now, on the off chance that anybody out there understands how any of this stuff works. :P
Hi
Rule 2 in the Rman article about the TXmake is a good point . In 3delight you could do something like " tdlmake -nomimap inputfile output.tdl "and pass the resulting output tdl file to the diffuse. However I'm not sure that is really necessary
I have a doubt about the advice on Gouraud Shading with the interpolation. I don't think we use Gouraud shading anymore anywhere because It's a very old tech that was used something like 10 years ago. And from my tests it seem to be correctly rendered without setting that parameter. I just created the network with both method ( 4 x s,t or swidth and twidth = 0 ) applied the shader and texture and I don't see any interpolation of the texture ( mine is 91 x 91. Is it too large? )
Attached are my texture (a preview of one of my Cornell box test )
And a rendered scene of the texture applied on a sphere and a cube
Am I missing something or is it about what you are looking for?
Hiya, thanks for the reply. The interpolation lies at the very edges of the colour sections, where there is a faint AA-blur between one colour and the next (e.g. up close).
I've written a very specific post-processing tool on 2D images to find outlines, which needs each pixel to be an exact known colour, so the few combined pixels between each colour section is making it problematic (especially since I'll need a large number of colours per scene, and neighbouring elements could combine to form another known colour, so I can't just find unknown colours in the image and ignore/replace them). I began to suspect that it might have something more to do in saving in a lossy image format, but checked and am definitely saving in Png, which as far as I know is always lossless.
For now, I've decided that the simplest solution might be to just write a software renderer which does what I need in Java, intending to export Obj versions of each scene since that seems the simplest format to parse, with a script which exports the camera transformation (if I can figure out the format of daz matrices).
wow you're zooming like crazy. But to me it is not Texture Interpolation that you see on zooming. That is either image compression or the shading over the object. But not related to texture anymore in my view
Anyway, if you want to implement the Shading interpolation to test if it brings something, you can render to RIB in DS and add a line in the exported RIB with
ShadingInterpolation ”constant”
Then you render with 3delight Standalone and see if it brings something
If you find an other way to get what you want that is cool too. Good luck
Yeah I agree that it may not necessarily be texture interpolation now (or, as the other link sort of mentioned, it might be a lesser form of something like interpolation due to a few other possibilities).
And thanks, I'll definitely try the 3Delight idea (my current software renderer is not playing nice with the imported x-axis and I was about to fire the whole project into the sun :P), it might just be the perfect solution (I actually did start playing with 3Delight Standalone earlier hoping for something along those lines, but was having trouble getting it to recognise environment variables, so dropped it, but will go back to it now).
As for the zooming in, I have a post-processor that needs to be able to cleanly identify colour blocks, pixel by pixel, so the AA-like lines were really throwing a spanner in that.
edit: Unfortunately adding the ShadingInterpolation "constant" didn't solve it, at this point I think that I'd need to take apart the whole rendering source code to know what's going on.
Ah, I've at least figured out that what I want is called "nearest neighbor" interpolation. http://en.wikipedia.org/wiki/Texture_filtering#Nearest-neighbor_interpolation
(Also known as Point Sampling)
Though from what I've read, it's not a simple thing to get from 3Delight.
Somehow a combination of the following settings worked:
PixelFilter "sinc" 1 1
ShadingInterpolation "constant"
ShadingRate .05
PixelSamples 1 1
Hider "hidden" "jitter" [0]
Going through ribs is a little bit of a long way around, since I need to add this to the rib file (plus for same reason Daz doesn't seem to be giving the output name a directory and then 3Delight fails), but at least it is a solution. :D
I was thinking you could eventually lower the shading rate ( to 0.1 ? ). The lower the shading rate, the more the renderer will "pass" over each pixel to get the color
I've yet to try the hider with jitter 0 to see the effect. I don't know what the defaults are with DS
Happy to see you've got a solution at least
I tried really low shading rates (a magnitude lower than the Daz UI allows at least) and it was improving it (with huge rendering times), but still never completely achieved what I needed. To be honest it was completely random that those combinations of things all happened to be in my RIB file at once on just about my last test (since it was resetting every time I recreated it from Daz to ensure that the temp tdlmake textures it pointed to existed).