Sign in to follow this  
MJW

Texture Object Rounder

Recommended Posts

The example should make it clearer.

 

As additional explanation, I added: "For the most common case of an object that's symmetric about the vertical axis, it produces a height map for the object of rotation. For example, it will convert a filled circle to a spherical height map, and a filled rectangle to a cylindrical height map."

Share this post


Link to post
Share on other sites

Great plugin @MJW!    :star:     Of course, I had to try it on a shape that wasn't recommended.  I see what you mean. Even though the butterfly is symmetrical, it doesn't handle it well around the body.

 

textureobjectrounder_01.png

 

I tried next on a recommended shape and the result is fantastic!  I smoothed the height map and applied an image with Texture Shader.

 

textureobjectrounder_02.png

 

 

There is so much potential here, I am speechless.....

 

Thank you!    <3

  • Like 2

Share this post


Link to post
Share on other sites
3 hours ago, Ishi said:

This is amazing. I think you can do a 3D-ish chess piece on this and many more! If you could combine shapes that it supports.

 

Thank you! The Texture Merger should help in combining shapes. The usual method is to use the Maximum merge mode. Make sure to set the Merged Height Alpha Source to Composite Alpha, so both height maps are visible.

Share this post


Link to post
Share on other sites

Really nice and useful, if you only need a tiny but high-quality single object and you don't want to install and handle a complex 3D-application like Blender.

  • Like 1

Share this post


Link to post
Share on other sites

This can have some neat results playing with Rotate/Zoom, then not using it as you should.  Great for alternative text results

 

object_tounder_test.png

  • Like 3

Share this post


Link to post
Share on other sites

More of a curiosity question than a bug report.

 

I like to use Shape3D to make shapes ... then use Texture Object Rounder in preparation for wrapping a texture.

T O R won't work unless you run AA -Assistant after rendering S3D. 

 

Just curious if there's a reason in the T O R end or in S3D as it's no big deal running AA Assistant

 

a video to show it better

 

https://www.youtube.com/watch?v=ue3iB0DFoVg

 

Share this post


Link to post
Share on other sites
1 hour ago, welshblue said:

Just curious if there's a reason in the T O R end or in S3D as it's no big deal running AA Assistant

 

That's weird. It doesn't do that for me. My best guess is that the background is almost but not entirely transparent after the shape is drawn (like the alpha is 1), and that AA's Assistant clears it. if you have Red ochre's Alpha Threshold, try using that instead of AA's Assistant, and see if that fixes the problem. If it does, the question is still, why isn't the background fully transparent? If it doesn't fix it, I'll have to look into it some more.

 

EDIT: More likely, the shape isn't entirely opaque. Perhaps for some reason the original image on which Shape3D is run is nearly, but not completely, opaque.

 

EDIT 2: Perhaps Shape3D's Transparency control is checked. I tried to tell in the video, but couldn't.

  • Like 1

Share this post


Link to post
Share on other sites

I'm even more confused. 

Sometimes running the Alpha Threshold works ... sometimes it doesn't.  But when it does work there's no subsequent issues on other layers after using it once

The results below are intermittent.  I've tried every which way.  Sometimes it works.  Sometimes it doesn't.  Sometimes it works just running S3D and T O R 😣

 

The transparency control wasn;t checked ... so on reading your second edit I kept it like that but increased the setting from default 208 to 255 ... T O R worked.

 

Did it again with the exact same steps  ... didn't work.  

 

This end it's no big deal and doesn't detract from a great plugin.  Is it worth spending time on ... could be S3D ?

And TBH what I know about coding you could write on a postage stamp in capital letters so am just grateful for what you guys do

Share this post


Link to post
Share on other sites

One thing that might be worth trying is to get one of the times Object Rounder doesn't work, then use the Color Picker to check the opacity of the background, and the center of the object, to see if the background pixels are entirely transparent, and the object contains completely opaque pixels.

Share this post


Link to post
Share on other sites
4 minutes ago, MJW said:

One thing that might be worth trying is to get one of the times Object Rounder doesn't work, then use the Color Picker to check the opacity of the background, and the center of the object, to see if the background pixels are entirely transparent, and the object contains completely opaque pixels.

 

Yeh I will.

 

But wouldn't you know it ... it worked when I was going to do that now 🤔

 

I swear cars are easier to understand 😀

Share this post


Link to post
Share on other sites

I finally got it to fail, and now I think I know why. When it didn't work, the alpha of the most opaque object pixels produced by Shape3D was 254. It happened after I increased Shape3D's AA to the maximum of 5. I don't know, though, that that was the cause or just a coincidence.

 

EDIT: I seems to be related to Shape3D's antialiasing. If I turn it off, or set the level to 1, the alphas are 255. If I set it to 2 or greater, the alphas are 254.

 

I should add that the Object Rounder always looks for completely opaque pixels to help determine the  starting edge of the object on each row of pixels. This has to do with its (not especially successful) attempt to determine the start and end of the edge to better-than-pixel precision.

Share this post


Link to post
Share on other sites

I 've had it fail when AA isn't enabled. When I'm next in front of the pc I'll have a play a nd make notes

 

Edit talking nonsense

Edited by welshblue

Share this post


Link to post
Share on other sites

You're right it's not T O R as such.

 

Your observations 

11 hours ago, MJW said:

I seems to be related to Shape3D's antialiasing. If I turn it off, or set the level to 1, the alphas are 255. If I set it to 2 or greater, the alphas are 254.

 

... are spot on.  Because I use a lot of xml files to load previous shapes with varying degrees of AA - I hadn't noticed the connection until I checked the files by loading them to check the AA settings.  It's no hassle if I want full AA on S3D to run AA-Assistant before Object Rounder

 

As I say - not a gripe.  I don't like not understanding why ... but now I do

Share this post


Link to post
Share on other sites

@Ego Eram Reputo was able to restore the xml feature. Perhaps he could fix the AA bug. I think I can take a pretty good guess about the basic cause. Shape3D uses the usual supersampling AA method, which requires summing the alphas, then dividing by the number of per-pixel samples. I expect that the division (which may be integer division) truncates or rounds down incorrectly.

 

One integer-division method that works properly is to double the alpha sum (by left shifting), add the number of per-pixel samples, then divide by twice the number of per-pixel samples. That amounts to adding 0.5, to round in the usual fashion.

                // Compute the (rounded) averages.
                int twiceA = a << 1;
                b = ((b << 1) + a) / twiceA;
                g = ((g << 1) + a) / twiceA;
                r = ((r << 1) + a) / twiceA;
                a = (twiceA + ssSamples) / ssTwiceSamples;
                return ColorBgra.FromBgra((byte)b, (byte)g, (byte)r, (byte)a); 

If Shape3D uses floating-point, the fix is probably just to add 0.5 before converting back to integers.

 

(I added the technical details for Ego Eram Reputo, though he most likely already knows them as well as I do.)

  • Like 1

Share this post


Link to post
Share on other sites
8 minutes ago, MJW said:

@Ego Eram Reputo was able to restore the xml feature. Perhaps he could fix the AA bug. I think I can take a pretty good guess about the basic cause. Shape3D uses the usual supersampling AA method, which requires summing the alphas, then dividing by the number of per-pixel samples. I expect that the division (which may be integer division) truncates or rounds down incorrectly. 

 

Makes perfect sense. 

Who am I kidding ... I'll take your good word for it.

 

Oil, grease, moving parts, any car repair and spanners I could do with my eyes closed.  Coding lingo goes straight over my head

Any image I make is 25% me 75% plugin authors - I don't really understand how it all works, just that it does 😀

 

Lines and lines of text and numbers to make something you can physically use ?  Witchcraft

Share this post


Link to post
Share on other sites
15 hours ago, MJW said:

I added the technical details for Ego Eram Reputo, though he most likely already knows them as well as I do)

 

I'm more of an elderly script-kiddie, so I like it when you do half my job for me :)

 

15 hours ago, welshblue said:

Lines and lines of text and numbers to make something you can physically use ?  Witchcraft

 

Some of my code requires actual living sacrifice - so witchcraft is not far off the mark ;)

 

(In an RPG I'm developing, I'm allowing the cost of magic (Mana) to be deducted from Hit Points or added as a number of months to the characters age. Coding seems similar in many respects)

Share this post


Link to post
Share on other sites
15 hours ago, Ego Eram Reputo said:

Some of my code requires actual living sacrifice - so witchcraft is not far off the mark

 

I was going to make a joke about the headline of a North Canterbury newspaper and frequent disappearances  in your area 

... but then I realised no matter what category/ subject I put,  I may upset someone, somewhere

 

Forget overpaid Footballers ... you guys are my heroes

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this