Re: [Pharo-users] Polygons in woden

2014-11-17 Thread Nicolas Lusa
Hi,
sorry for the late response.
Thanks a lot for the hints. Though I didn't explain me well enough for what 
concern the shades. What I actually meant is how light gets reflected from the 
object. If I build a cube with: addCubeWithWidth I get a nicely dark effect on 
the walls of the object when the light is not pointing to it and a shiny effect 
when the light is pointing towards to it. While if I build a object on my own 
with addQl the walls are not considering the light at all and I don't get that 
effect anymore. Does anyone know how to solve this?

Moreover do you think it is possible to use some how GLPolygon to draw 
arbitrary polygons since woden is based on Open GL?

Cheers,
Nicolas.

On Nov 9, 2014, at 11:12 PM, Ronie Salgado 
ronies...@gmail.commailto:ronies...@gmail.com wrote:

Hi Nicola,

Sorry for not answering before. I have to improve my mail filters.

As for the shadows, currently only the spotlights can cast shadows. I have yet 
to implement shadow mapping for directional lights. As for point light, I won't 
be implementing them in the near future, because they are very expensive. 
Currently you can simulate a point light casting shadows by using 6 spotlights 
with different orientations but in the same point.

Also, you have to use deferred shading if you need shadows (WDFPSSimpleExample8 
 #initializeSceneRenderer)

As for the polygons, Woden cannot render arbitrary polygons. Only points, 
lines, triangles and quads because that is what the graphics cards support.

For an arbitrary polygon, you have to perform some kind of triangulation. If 
the polygon is convex, this is trivial, but if the polygon is concave this is 
hard (the algorithm missing is a Restricted Delaunay Triangulation).

For drawing a convex polygon, you have to do something like this:

positions := Some Collection ..

builder newTrianglesScope.

Add the positions.
positions do: [:i |
  builder addP: 
].

Add the indices
3 to: positions size do: [:i |
  builder addI1: 1 i2: i - 1 i3: i
].

What this code does is to generate a triangle fan ( 
http://en.wikipedia.org/wiki/Triangle_fan  ) which is a simple way to 
triangulate a convex polygon.

I think that I should add a method to the geometry builder.

Greetings,
Ronie



2014-10-28 11:33 GMT-03:00 Nicolas Lusa 
nicolas.l...@usi.chmailto:nicolas.l...@usi.ch:
Hi everyone,

I am working on some 3d representation and I am trying to draw 3D polygons with 
woden. I actually manage to make the walls but I still have to implement top 
and bottom parts which are not so simple since the shape can be really 
different from case to case.
How I am actually doing it is with: WDGeometryBuilder adding vertices with 
addP:  N:  C:  TC: messages and with addQuadI1: i2: i3: i4:
Furthermore I have some issues with the shadows which actually don't appear.

You can see a current polygon created with the code that I made in the attached 
image. (also notice the shadows are missing as well as the bottom and top part 
of the polygon).
[cid:E6905B6F-F5CA-447D-A42D-BA1604AC7F5A@mobile.usilu.netmailto:cid%3ae6905b6f-f5ca-447d-a42d-ba1604ac7...@mobile.usilu.net]
Now my question is: is there already something that makes those polygons or 
does anyone have any hint on how to make the top part with woden?

Thannks in advance.

Cheers,
Nicolas





Re: [Pharo-users] Polygons in woden

2014-11-09 Thread Ronie Salgado
Hi Nicola,

Sorry for not answering before. I have to improve my mail filters.

As for the shadows, currently only the spotlights can cast shadows. I have
yet to implement shadow mapping for directional lights. As for point light,
I won't be implementing them in the near future, because they are very
expensive. Currently you can simulate a point light casting shadows by
using 6 spotlights with different orientations but in the same point.

Also, you have to use deferred shading if you need shadows
(WDFPSSimpleExample8  #initializeSceneRenderer)

As for the polygons, Woden cannot render arbitrary polygons. Only points,
lines, triangles and quads because that is what the graphics cards support.

For an arbitrary polygon, you have to perform some kind of triangulation.
If the polygon is convex, this is trivial, but if the polygon is concave
this is hard (the algorithm missing is a Restricted Delaunay Triangulation).

For drawing a convex polygon, you have to do something like this:

positions := Some Collection ..

builder newTrianglesScope.

Add the positions.
positions do: [:i |
  builder addP: 
].

Add the indices
3 to: positions size do: [:i |
  builder addI1: 1 i2: i - 1 i3: i
].

What this code does is to generate a triangle fan (
http://en.wikipedia.org/wiki/Triangle_fan  ) which is a simple way to
triangulate a convex polygon.

I think that I should add a method to the geometry builder.

Greetings,
Ronie



2014-10-28 11:33 GMT-03:00 Nicolas Lusa nicolas.l...@usi.ch:

 Hi everyone,

 I am working on some 3d representation and I am trying to draw 3D polygons
 with woden. I actually manage to make the walls but I still have to
 implement top and bottom parts which are not so simple since the shape can
 be really different from case to case.
 How I am actually doing it is with: WDGeometryBuilder adding vertices with
 addP:  N:  C:  TC: messages and with addQuadI1: i2: i3: i4:
 Furthermore I have some issues with the shadows which actually don't
 appear.

 You can see a current polygon created with the code that I made in the
 attached image. (also notice the shadows are missing as well as the bottom
 and top part of the polygon).
 [cid:E6905B6F-F5CA-447D-A42D-BA1604AC7F5A@mobile.usilu.net]
 Now my question is: is there already something that makes those polygons
 or does anyone have any hint on how to make the top part with woden?

 Thannks in advance.

 Cheers,
 Nicolas



[Pharo-users] Polygons in woden

2014-10-28 Thread Nicolas Lusa
Hi everyone,

I am working on some 3d representation and I am trying to draw 3D polygons with 
woden. I actually manage to make the walls but I still have to implement top 
and bottom parts which are not so simple since the shape can be really 
different from case to case.
How I am actually doing it is with: WDGeometryBuilder adding vertices with 
addP:  N:  C:  TC: messages and with addQuadI1: i2: i3: i4:
Furthermore I have some issues with the shadows which actually don't appear.

You can see a current polygon created with the code that I made in the attached 
image. (also notice the shadows are missing as well as the bottom and top part 
of the polygon).
[cid:E6905B6F-F5CA-447D-A42D-BA1604AC7F5A@mobile.usilu.net]
Now my question is: is there already something that makes those polygons or 
does anyone have any hint on how to make the top part with woden?

Thannks in advance.

Cheers,
Nicolas