preview bug?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

preview bug?

adrianv
When I preview this model my shape jumps back and forth at certain points of
rotation between the correct object and a flipped object.  

module right_half(s=10000, x=0, planar=false)
{
  dir = [1,0,0];  
  difference() {
    children();
    translate([x,0,0]-dir*s/2)
      cube(s, center=true);
  }
}


$fn=96;
right_half()
  linear_extrude(height=20,convexity=10)
    difference() {
       square(10,center=true);
       circle(r=4);
    }
   

The two images are taken with the angular view just slightly displaced, as
you can see from the axes, without doing anything bug spinning the model.  
Note that the behavior depends on the s parameter to the right_half()
function.  If I change that value, the behavior may go away, or it may
happen at a different viewpoint.  

<http://forum.openscad.org/file/t2477/view1.png>
<http://forum.openscad.org/file/t2477/view2.png>




--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: preview bug?

nophead
It is because OpenCSG (which is used to generate the preview) has to draw negative objects in their entirity. If your large cube in right_half() does not fit in the viewing area it gets clipped and the difference goes wrong. Add a render to make it work consistently.

 See https://github.com/nophead/NopSCADlib#Clip for a general version.

On Fri, 14 Feb 2020 at 18:15, adrianv <[hidden email]> wrote:
When I preview this model my shape jumps back and forth at certain points of
rotation between the correct object and a flipped object. 

module right_half(s=10000, x=0, planar=false)
{
  dir = [1,0,0]; 
  difference() {
    children();
    translate([x,0,0]-dir*s/2)
      cube(s, center=true);
  }
}


$fn=96;
right_half()
  linear_extrude(height=20,convexity=10)
    difference() {
       square(10,center=true);
       circle(r=4);
    }


The two images are taken with the angular view just slightly displaced, as
you can see from the axes, without doing anything bug spinning the model. 
Note that the behavior depends on the s parameter to the right_half()
function.  If I change that value, the behavior may go away, or it may
happen at a different viewpoint. 

<http://forum.openscad.org/file/t2477/view1.png>
<http://forum.openscad.org/file/t2477/view2.png>




--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: preview bug?

thehans
More specifically its due to putting the camera inside of your geometry

This is an inherent issue with perspective projection because the clipping plane must be in front of the camera(focal point).
Orthographic projection actually avoids this sort of issue, because rather than having a focal point, it can define the view as a volume of space which extends behind the camera just as far as it extends in front of it.

On Fri, Feb 14, 2020 at 12:27 PM nop head <[hidden email]> wrote:
It is because OpenCSG (which is used to generate the preview) has to draw negative objects in their entirity. If your large cube in right_half() does not fit in the viewing area it gets clipped and the difference goes wrong. Add a render to make it work consistently.

 See https://github.com/nophead/NopSCADlib#Clip for a general version.

On Fri, 14 Feb 2020 at 18:15, adrianv <[hidden email]> wrote:
When I preview this model my shape jumps back and forth at certain points of
rotation between the correct object and a flipped object. 

module right_half(s=10000, x=0, planar=false)
{
  dir = [1,0,0]; 
  difference() {
    children();
    translate([x,0,0]-dir*s/2)
      cube(s, center=true);
  }
}


$fn=96;
right_half()
  linear_extrude(height=20,convexity=10)
    difference() {
       square(10,center=true);
       circle(r=4);
    }


The two images are taken with the angular view just slightly displaced, as
you can see from the axes, without doing anything bug spinning the model. 
Note that the behavior depends on the s parameter to the right_half()
function.  If I change that value, the behavior may go away, or it may
happen at a different viewpoint. 

<http://forum.openscad.org/file/t2477/view1.png>
<http://forum.openscad.org/file/t2477/view2.png>




--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: preview bug?

thehans
Oops, I should say: it can *sort of* avoid the issue, but it is still dependent on how far zoomed in you are, which limits the size of that clipping volume (it still has to be finite because depth buffer has limited precision).

On Fri, Feb 14, 2020 at 2:02 PM Hans L <[hidden email]> wrote:
More specifically its due to putting the camera inside of your geometry

This is an inherent issue with perspective projection because the clipping plane must be in front of the camera(focal point).
Orthographic projection actually avoids this sort of issue, because rather than having a focal point, it can define the view as a volume of space which extends behind the camera just as far as it extends in front of it.

On Fri, Feb 14, 2020 at 12:27 PM nop head <[hidden email]> wrote:
It is because OpenCSG (which is used to generate the preview) has to draw negative objects in their entirity. If your large cube in right_half() does not fit in the viewing area it gets clipped and the difference goes wrong. Add a render to make it work consistently.

 See https://github.com/nophead/NopSCADlib#Clip for a general version.

On Fri, 14 Feb 2020 at 18:15, adrianv <[hidden email]> wrote:
When I preview this model my shape jumps back and forth at certain points of
rotation between the correct object and a flipped object. 

module right_half(s=10000, x=0, planar=false)
{
  dir = [1,0,0]; 
  difference() {
    children();
    translate([x,0,0]-dir*s/2)
      cube(s, center=true);
  }
}


$fn=96;
right_half()
  linear_extrude(height=20,convexity=10)
    difference() {
       square(10,center=true);
       circle(r=4);
    }


The two images are taken with the angular view just slightly displaced, as
you can see from the axes, without doing anything bug spinning the model. 
Note that the behavior depends on the s parameter to the right_half()
function.  If I change that value, the behavior may go away, or it may
happen at a different viewpoint. 

<http://forum.openscad.org/file/t2477/view1.png>
<http://forum.openscad.org/file/t2477/view2.png>




--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: preview bug?

adrianv
In reply to this post by nophead
So this means that the inability to get the bounds of geometry is more
serious than I realized, because you can't just use large objects.  If I
have to force a render for this then that means possibly long wait times and
I can't color objects.  


nophead wrote
> It is because OpenCSG (which is used to generate the preview) has to draw
> negative objects in their entirity. If your large cube in right_half()
> does
> not fit in the viewing area it gets clipped and the difference goes wrong.
> Add a render to make it work consistently.
>
>  See https://github.com/nophead/NopSCADlib#Clip for a general version.
>
> On Fri, 14 Feb 2020 at 18:15, adrianv &lt;

> avm4@

> &gt; wrote:
>
>> When I preview this model my shape jumps back and forth at certain points
>> of
>> rotation between the correct object and a flipped object.
>>
>> module right_half(s=10000, x=0, planar=false)
>> {
>>   dir = [1,0,0];
>>   difference() {
>>     children();
>>     translate([x,0,0]-dir*s/2)
>>       cube(s, center=true);
>>   }
>> }
>>
>>
>> $fn=96;
>> right_half()
>>   linear_extrude(height=20,convexity=10)
>>     difference() {
>>        square(10,center=true);
>>        circle(r=4);
>>     }
>>
>>
>> The two images are taken with the angular view just slightly displaced,
>> as
>> you can see from the axes, without doing anything bug spinning the model.
>> Note that the behavior depends on the s parameter to the right_half()
>> function.  If I change that value, the behavior may go away, or it may
>> happen at a different viewpoint.
>>
>> &lt;http://forum.openscad.org/file/t2477/view1.png&gt;
>> &lt;http://forum.openscad.org/file/t2477/view2.png&gt;
>>
>>
>>
>>
>> --
>> Sent from: http://forum.openscad.org/
>>
>> _______________________________________________
>> OpenSCAD mailing list
>>

> Discuss@.openscad

>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>>
>
> _______________________________________________
> OpenSCAD mailing list

> Discuss@.openscad

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org





--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: preview bug?

Parkinbot
You can color a rendered object, while colors gets lost when you render a
colored object.



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: preview bug?

adrianv
Parkinbot wrote
> You can color a rendered object, while colors gets lost when you render a
> colored object.

I think one of the uses for a function like this to examine the internals of
some possibly complex model, so if my model has lots of different parts, the
colors will be lost.  




--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: preview bug?

nophead
I don't think that is possible in OpenSCAD even without render. Whenever you cut an object with OpenCSG the cut face has the colour of the subtrahend.

On Sun, 16 Feb 2020 at 16:08, adrianv <[hidden email]> wrote:
Parkinbot wrote
> You can color a rendered object, while colors gets lost when you render a
> colored object.

I think one of the uses for a function like this to examine the internals of
some possibly complex model, so if my model has lots of different parts, the
colors will be lost. 




--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: preview bug?

adrianv
Cut face may be the wrong color, but if the object has internal holes then
the other surfaces will be colored.


nophead wrote
> I don't think that is possible in OpenSCAD even without render. Whenever
> you cut an object with OpenCSG the cut face has the colour of the
> subtrahend.
>
> On Sun, 16 Feb 2020 at 16:08, adrianv &lt;

> avm4@

> &gt; wrote:
>
>> Parkinbot wrote
>> > You can color a rendered object, while colors gets lost when you render
>> a
>> > colored object.
>>
>> I think one of the uses for a function like this to examine the internals
>> of
>> some possibly complex model, so if my model has lots of different parts,
>> the
>> colors will be lost.
>>
>>
>>
>>
>> --
>> Sent from: http://forum.openscad.org/
>>
>> _______________________________________________
>> OpenSCAD mailing list
>>

> Discuss@.openscad

>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>>
>
> _______________________________________________
> OpenSCAD mailing list

> Discuss@.openscad

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org





--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org