Method or plugin for subdividing like this sample

Method or plugin for subdividing like this sample

Postby cesaro36 » Thu Aug 03, 2017 10:21 pm

Hi everyone
Is there any plugin or code snippet that creates this kind of subdivision, basically is a offset from each edge in a solid component?
My goal is to smooth corners at objects prior to any rendering.
2017.08.03-Screenshot_CSR-0311_01.png


Saludos
0

cesaro36 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby sdmitch » Fri Aug 04, 2017 12:40 am

Code: Select all
mod = Sketchup.active_model
ent = mod.active_entities
sel = mod.selection
vue = mod.active_view; pts =[]
sel.grep(Sketchup::Face).each{|f|
 vec = f.normal.reverse
 pts << f.vertices.map{|v|v.position.offset(vec)}
}
pts.each{|p| f=ent.add_face(p); f.erase!}
1
Nothing is worthless, it can always be used as a bad example.

http://sdmitch.blogspot.com/
User avatar
sdmitch 
PluginStore Author
PluginStore Author
 

Re: Method or plugin for subdividing like this sample

Postby cesaro36 » Fri Aug 04, 2017 5:21 am

How simple you make it look like.
Thanks. I'll dig into it.
1

cesaro36 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby Pixero » Fri Aug 04, 2017 8:45 am

Thanks for the code Sam. :thumb:

It works great for the example where faces are perpendicular but not with something with non perpendicular faces. See attached SKP (SU8). Could that be added?

Offset problems.skp
0
User avatar
Pixero 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby sdmitch » Fri Aug 04, 2017 4:42 pm

Pixero wrote:It works great for the example where faces are perpendicular but not with something with non perpendicular faces.


Code: Select all
mod = Sketchup.active_model
ent = mod.active_entities
sel = mod.selection
vue = mod.active_view; pts =[]
faces = sel.grep(Sketchup::Face)
faces.each{|f|
 vec = f.normal.reverse; ctr = f.bounds.center
 pts << f.vertices.map{|v|v.position.offset(ctr.vector_to(v.position)).offset(vec)}
}
grp=ent.add_group; ge=grp.entities; gt=grp.transformation
pts.each{|p|
 fgrp=ent.add_group;fge=fgrp.entities;fgt=fgrp.transformation
 f=fge.add_face(p);
 fge.intersect_with false,fgt,ge,gt,false,faces
 fgrp.erase!
}
grp.explode
1
Nothing is worthless, it can always be used as a bad example.

http://sdmitch.blogspot.com/
User avatar
sdmitch 
PluginStore Author
PluginStore Author
 

Re: Method or plugin for subdividing like this sample

Postby Pixero » Fri Aug 04, 2017 7:35 pm

I tried the new code and it's better but for other non perpendicular faces it still gives some weird results.
A cylinder for example.
I have attached another example of that below. Hopefully it's possible to get it right for these cases also.

Offset errors 2.skp
0
User avatar
Pixero 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby sdmitch » Fri Aug 04, 2017 8:03 pm

Pixero wrote:A cylinder



The initial request was for a simple box.
0
Nothing is worthless, it can always be used as a bad example.

http://sdmitch.blogspot.com/
User avatar
sdmitch 
PluginStore Author
PluginStore Author
 

Re: Method or plugin for subdividing like this sample

Postby Pixero » Fri Aug 04, 2017 8:17 pm

:oops:

But the code was so useful I couldn't help myself wanting it to work on more types of objects...

...what if I say: please?
1
User avatar
Pixero 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby JQL » Fri Aug 04, 2017 11:44 pm

I see a lot of possibilities here.

Fake beveling at render time?

Please Sam?
1
User avatar
JQL 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby sdmitch » Sun Aug 06, 2017 5:51 pm

JQL wrote:I see a lot of possibilities here.

Fake beveling at render time?

Please Sam?


Sorry guys but I see no possibilities. In fact it is impossible. Why, because the 'offsets' only work if all the angles at a 'corner' are the same. Plus, what do you with 'concave' angled corners?
0
Nothing is worthless, it can always be used as a bad example.

http://sdmitch.blogspot.com/
User avatar
sdmitch 
PluginStore Author
PluginStore Author
 

Re: Method or plugin for subdividing like this sample

Postby Pixero » Sun Aug 06, 2017 6:48 pm

In Thomthom's EdgeTools there is a script for manually diving faces called "Divide Face".
It have some clever ways of getting the "splitting edge" to match the face's surrounding edges.
Maybe if you took a look at how he does it there it might be possible to implement into your code?
0
User avatar
Pixero 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby fredo6 » Sun Aug 06, 2017 7:05 pm

Guys,

This is what Roundcorner does in the first place. So doable, but the code is not exactly concise and straightforward to catch all topological situations, especially those where the offset line don't meet at corner edges, as highlighted by sdmitch (just take an elongated pyramide for instance). Not mentioning concave corners and other complex geometry...

Fredo
0
User avatar
fredo6 
PluginStore Author
PluginStore Author
 

Re: Method or plugin for subdividing like this sample

Postby Pixero » Sun Aug 06, 2017 7:20 pm

@fredo:

So, when will your new version with all quad face corners be ready?
I believe you posted a sneak peak some time ago.
0
User avatar
Pixero 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby JQL » Mon Aug 07, 2017 9:21 am

That's a pity, but thanks fo the explanation. When rendering an architectural subject bevels make a lot of difference in image results and realism. However when working they are too cumbersome and when sending to Layout or CAD to document the building and dimension it, they become even moreof a nuisance.

Having some kind of temporary bevelling that you could toggle, loke subd, would solve the issue.

I guess a lot of us would find that an incredible tool and I thought, for a moment, it would be possible...

Even so,thanks for your time gentlemen!
1
User avatar
JQL 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby cesaro36 » Mon Aug 07, 2017 4:41 pm

Hi guys

This is what I came up with a few months ago, but it fails when curves or inner loops exist.

Also it uses the offset.rb from Smustard(TM).
By using this combination of soft and smooth you are able to put correct dimensions in both SKP and LO
If you need to get rid of the changes the plugin Fix101 takes care of it.

Any ideas to improve this?



#CSR create soften edges for renders
ss = Sketchup.active_model.selection
Sketchup.active_model.start_operation("test")
old_edges = []
new_faces = []
ss.each{|e|old_edges.push e if e.class == Sketchup::Edge}
ss.each{|s|new_faces.push s.offset(-0.0625) if s.class == Sketchup::Face}
old_edges.each{|oe| oe.smooth = true}
new_faces.each{|nf| nf.edges.each{|nfe| nfe.soft = true; nfe.hidden = true}}
Sketchup.active_model.commit_operation

2017.08.07-Screenshot_CSR-0919_01.png

2017.08.07-Screenshot_CSR-0919_02.png

2017.08.07-Screenshot_CSR-0921_01.png
1

cesaro36 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby Pixero » Wed Aug 09, 2017 9:13 am

@cesaro36:

After adding offset.rb it worked.
However the old edges are hard and the new ones are soft.
0
User avatar
Pixero 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby JQL » Wed Aug 09, 2017 9:36 am

Can anyone convert it to a plugin?
0
User avatar
JQL 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby Pixero » Wed Aug 09, 2017 9:53 am

I'm trying...

I think it would work better if it only operated on edges that are hard.
How would one do that?
0
User avatar
Pixero 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby JQL » Wed Aug 09, 2017 9:59 am

And do you think it could have a method for operating at render time or is it too slow for that?

Like tag some objects and apply the effect when hitting Thea's render button and then undo it (using skatter's method)?
0
User avatar
JQL 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby Pixero » Wed Aug 09, 2017 10:07 am

I don't know yet.
It has some bugs as it's not working correctly on for example a cylinder with soft edges. And some other things that would need solving first.
0
User avatar
Pixero 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby Hieru » Wed Aug 09, 2017 10:28 am

I do this sort of thing manually on a daily basis and it is frustrating that a number of plugins come very close to automating much of the process.

A quad version of Round Corner with a subdivision mode (just adding the required loops) would be awesome.

Having more control over the addition of loops in Quad Face Tools would be very helpful. I seem to recall that this is planned for the next version.

For subdivision at render, I think that could be possible with SubD at some point in the future. I imagine that getting it to play nice with all the different render engines will be quite a big ask.
0
User avatar
Hieru 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby JQL » Wed Aug 09, 2017 12:40 pm

Hieru wrote:For subdivision at render, I think that could be possible with SubD at some point in the future. I imagine that getting it to play nice with all the different render engines will be quite a big ask.


I remember Thomthom was talking with both Thomas (Jiminy) and Tomasz to make it happen. Maybe it's being developed as we speak, maybe it stalled.

Anyway what I wanted was simply to have raw geometry without bevels, so I could design easily with sketchup and some method to fake bevels so I could render realistically, but I don't want to have permanent bevels.

In the end I always sacrifice bevels so I can keep desiging but the results are always too CG... that's the best option I have for my workflow...
1
User avatar
JQL 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby Hieru » Thu Aug 10, 2017 4:54 pm

JQL wrote:I remember Thomthom was talking with both Thomas (Jiminy) and Tomasz to make it happen. Maybe it's being developed as we speak, maybe it stalled.


Yes, some Skatter wisdom would probably help to move things in that direction.

JQL wrote:Anyway what I wanted was simply to have raw geometry without bevels, so I could design easily with sketchup and some method to fake bevels so I could render realistically, but I don't want to have permanent bevels.

The way I envisioned that working would involve a new version of Round Corner that adds the loops needed for SubD bevelling and then assigning a SubD @ Render condition to the geometry.

Whilst it wouldn't reduce the geometry/calculations rendered, it would keep models manageable and be partly non-destructive.

Naturally the ideal would be completely non-destructive bevels, but that's not going to happen without major changes to SUp's core engine.

Personally I leave all bevelling until the last minute, when I know there won't be any design changes. Sometimes I'll save non-bevelled versions of components in my project file - just in case.
0
User avatar
Hieru 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby Pixero » Thu Aug 10, 2017 5:21 pm

Don't know if it's possible but if so, running a script right before and after render could perhaps create a fairly non destructive workflow.
0
User avatar
Pixero 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby JQL » Thu Aug 10, 2017 11:13 pm

Hieru wrote:Personally I leave all bevelling until the last minute, when I know there won't be any design changes. Sometimes I'll save non-bevelled versions of components in my project file - just in case.


LOL... What about last minute changes?

The thing with rendering, in my case, is that I do it to test design and let it cook longer to show it off to my clients.

Bevels make a lot of difference but sincerelly, my clients don't give a damn about that added realism. However I've seen the work of render gurus like yourselves and get frustrated with my results.

So I want bevels, but I don't need them, but I want them, but I don't need them... I guess turning them on and off would be the ideal solution.
0
User avatar
JQL 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby Hieru » Fri Aug 11, 2017 3:51 pm

I agree, turning them on and off would be ideal; but since that isn't possible, you can't avoid destructive bevelling if you want that extra level of realism.

As for last minute changes, I don't run the final renders until the client has fully signed off on the design and they are aware that no major revisions are possible. Up to that point I present draft renders without the bevelling.
0
User avatar
Hieru 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby Pixero » Fri Aug 11, 2017 8:13 pm

I emailed Thomasz and he said it is possible to run a script before render and another after.
So in theory if we had a bevelscript and ran it before render and then undo that after we would have a non destructive way of doing it.
0
User avatar
Pixero 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby JQL » Sat Aug 12, 2017 1:32 pm

Hieru wrote:As for last minute changes, I don't run the final renders until the client has fully signed off on the design and they are aware that no major revisions are possible. Up to that point I present draft renders without the bevelling.


In that regard I'm my own client and I never agree that major revisions aren't possible :)

Pixero wrote:I emailed Thomasz and he said it is possible to run a script before render and another after.
So in theory if we had a bevelscript and ran it before render and then undo that after we would have a non destructive way of doing it.


The ideal solution would be to do this in the shader with the bevel procedural or, like I used to, with the wireframe procedural, that Presto doesn't support.
0
User avatar
JQL 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby tuna1957 » Tue Aug 15, 2017 12:20 am

Just stumbled on this post. Maybe I can shine a little light on this for all of you. Your attacking this "bevel" issue from the wrong end.
I use TwilightV2 Pro and it has exactly what your looking for. In Twilight it's called "Bevel Modifier", you assign it to the material of choice, for example your kitchen counter top material. The "Bevel Modifier" lets you set the perimeters for how you want the bevel to appear in your render. I have no idea how it works except it's all done on the render side , it doesn't physically change model geometry. I do know it works like a champ.
Instead of coming up with scripts to run tiny little bevels all over your model check into your render engine of choice and see if it has a bevel function like Twilight. If not go to their forum and plant the seed that they add a bevel function asap.
0

tuna1957 
Premium Member
Premium Member
 

Re: Method or plugin for subdividing like this sample

Postby JQL » Tue Aug 15, 2017 12:38 am

tuna1957 wrote:Just stumbled on this post. Maybe I can shine a little light on this for all of you. Your attacking this "bevel" issue from the wrong end.
I use TwilightV2 Pro and it has exactly what your looking for. In Twilight it's called "Bevel Modifier", you assign it to the material of choice, for example your kitchen counter top material. The "Bevel Modifier" lets you set the perimeters for how you want the bevel to appear in your render. I have no idea how it works except it's all done on the render side , it doesn't physically change model geometry. I do know it works like a champ.
Instead of coming up with scripts to run tiny little bevels all over your model check into your render engine of choice and see if it has a bevel function like Twilight. If not go to their forum and plant the seed that they add a bevel function asap.


LOL... if you only knew...

We here are planting that seed for as long as I remember.

Twilight comes from the Kerkythea engine, if I'm not mistaken. KT used to have it and I guess most of the askers here used that engine to some extent.
0
User avatar
JQL 
Premium Member
Premium Member
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to Developers' Forum

Who is online

Users browsing this forum: No registered users and 9 guests

Visit our sponsors: