|
Post by scalion on Jun 6, 2022 9:04:01 GMT 1
Hi Scalion, Did you have an idea how to render a simple diffuse fake shadows into a texture? You see a house from top. I painted this with Photoshop. This polygon house has 17 points. Looking from Top! At the 2D concave points 1,4,7,8,11,12,15 I need to draw areas like a shadow. The green area is a simple texture. It's all simple 2D. Did you have an idea to simply plot these darken diffuse areas ? I really need some help. Thank you!
Following your prerogatives, I coded this but I find that the result is not great. If you want I can look into a slightly more "raytracing" approach, what do you think?
Edit (10/06/2022) :
This is what I get with raytracing, but it's damn long (10mn mini)... I'll put the code when I get it.
|
|
|
Post by Roger Cabo on Jun 7, 2022 23:22:37 GMT 1
Thank you very much! It completely goes into the correct direction. I have looked into today and tried a hallway. Unfortunately the hallway does not work well. See screenshot.
Perhaps a more ray-traced version would work better?
Here is the data set of the house with hallway. I'm very impressed of your acknowledge! really great..
house: Data 0,50 // 0 Data 50,50 // 1 Data 50,0 // 2 Data 250,0 // 3 Data 250,150 // 4 Data 350,150 // 5 Data 350,200 // 6
Data 150,200 // 7 Data 150,80 // 8 Data 50,80 // 9 Data 50,100 // 10
Data 130,100 // 11 Data 130,240 // 12
Data 350,240 // 13 Data 350,280 // 14 Data 320,280 // 15 Data 250,400 // 16 Data 250,450 // 17 Data 120,450 // 18 Data 120,370 // 19 Data 0,370 // 20
The 2nd is only painted by me. If you get it in this direction, it would be awesome!!!
Attachments:
|
|
|
Post by Roger Cabo on Jun 10, 2022 23:01:01 GMT 1
Edit (10/06/2022) :
This is what I get with raytracing, but it's damn long (10mn mini)... I'll put the code when I get it.
<button disabled="" class="c-attachment-insert--linked o-btn--sm">Attachment Deleted</button>
WOW.. that looks amazing!!! Thank you for the work. Don't worry about the time for ray tracing. The sizes of the house is in meters.. Please use:
While _Data Inc hcount Read hx(hcount), hy(hcount)
hx(hcount) /= 10 // <-------- hy(hcount) /= 10 // <--------
hx(hcount) += 100 hy(hcount) += 100 Wend The real house size is about divided by 10. Now the texture is 1 pixel per 1 meters. So it needs only 100th of the time. There are some great rendering options for your code possible. Using smoothstep() to optimize the gradient.
But I will do this later if you have the code.
|
|
|
Post by scalion on Jun 11, 2022 13:52:19 GMT 1
Well, this code is not optimised, i come back later for a better fonctionnality. To have a good rendering, 512 ray for each point is necessary. Shadows by raytrace.G32 (13.24 KB)
|
|
|
Post by Roger Cabo on Jun 11, 2022 19:49:49 GMT 1
I have a small issue when using:
A)
For i = 0 To N - 1 Read p(i).x, p(i).y p(i).x /= 2 p(i).y /= 2 Next i
B) TraceShadows3(xmin - Marge, ymin - Marge, xmax + Marge, ymax + Marge, Marge, 128)
C) 'DrawFilledHouse <-- comment out RGBColor 0 'DrawHouseLines <- comment out
Then I got some strange lines. Any ideas? Anyway absolutely nice! If you get the little issues away, then we are done!
|
|
|
Post by scalion on Jun 12, 2022 10:56:59 GMT 1
I have a small issue when using:
A)
For i = 0 To N - 1 Read p(i).x, p(i).y p(i).x /= 2 p(i).y /= 2 Next i
B) TraceShadows3(xmin - Marge, ymin - Marge, xmax + Marge, ymax + Marge, Marge, 128)
C) 'DrawFilledHouse <-- comment out RGBColor 0 'DrawHouseLines <- comment out
Then I got some strange lines. Any ideas? Anyway absolutely nice! If you get the little issues away, then we are done!
This problem come from VertexInPolygon function. I corrected it
|
|
|
Post by Roger Cabo on Jun 14, 2022 15:31:33 GMT 1
Thanks man! Works great.. Rendering takes only some seconds with the right settings!
The next days I will transfer it to c# and make some tests win easy buildings.
* It's only important to shrink the polygon points positions for 1 pixel. * Use RGB(128,128,128) for the background instead of black.
I will post some screenshots if I got it.
|
|
|
Post by Roger Cabo on Jul 5, 2022 15:45:57 GMT 1
Hi Scalion,
do you have an idea, when rendering 2 polygons or more at the same time? I have one house with polygons in: p().x and p().y. And another one in: p2().x and p2().y.
Houses are sometimes overlapping a bit
Do you think it's possible to render N houses (polygones arrays) at the same time? So if we have 2 or more houses close to each other they take all the walls in to account?
|
|