Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 58
Posts: 58   Pages: 6   [ Previous Page | 1 2 3 4 5 6 | Next Page ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 181763 times and has 57 replies Next Thread
Keet
Advanced Member
Member's Avatar

Netherlands
Joined: Apr 8, 2022
Post Count: 742
Status: Offline
Reply to this Post  Reply with Quote 
Re: Terrain Generator plug-in

Well, you can't say I'm not persistent, so I cheated.

For those who want to start with an equal elevation like I explained:

1. Create the room.
2. Switch off ceiling.
3. Optionally set a color or texture.
4. Select the room and start the Terrain Generator.
5. Set the expansion scale to 100000.
6. With the Shift key raise everything to a level >0.
7. Generate the terrain (OK button).
8. Save your Plan.

So far just like creating a normal terrain.

Now the 'cheating':
1. Unzip the SH3D file (you might need to add a zip extension first).
2. Make a copy of the Home.xml file in the unzipped directory to a working directory.
3. Open the the copied file and replace the value part on every line with "terrainElevationAt" with a value "250.000". 250 is the height, set it to the height you want. Since this can be a lot of lines (300000+ for me) I wrote a little Python routine to do this.
4. Save the file and copy it to the previously unzipped directory (overwriting the original file).
5. Zip all the files in your unzipped directory and remove the .zip extension from the resulting zip file. This should leave you with the original .sh3d file but with the changed Home.xml file.
6. Open the updated .sh3d file with SH3D and remove the terrain object (NOT the room!).
7. Select the room and start the Terrain Generator again.
8. You now have a terrain set at the height 250 and you can depress or raise parts to create a new terrain.
9. Save the terrain with OK button and you get a new terrain object.

Keet
[May 3, 2022, 1:02:45 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Keet
Advanced Member
Member's Avatar

Netherlands
Joined: Apr 8, 2022
Post Count: 742
Status: Offline
Reply to this Post  Reply with Quote 
Re: Terrain Generator plug-in

Emmanuel, when you get to adding features to the Terrain Generator please consider these:

1. A highlighted point where the mouse is on the terrain.
Currently it's a huge guess where elevation will occur on large terrains. Sometimes far from where you thought you clicked.

2. At least a single level of undo (if that doesn't cause memory problems)

3. Pan left/right and up/down
This makes it easier to zoom into where you want, especially with larger terrains.

4. Keyboard keys to rotate/tilt and pan.
If you zoom in to far you can no longer place the mouse at the side to do that. I would suggest the arrow keys for rotate/tilt and ctrl+arrow keys for panning.

5. Elevation accuracy: if you can't zoom in far enough you have very little control over how much elevation a mouse movement will trigger.

6. Set a max height: this so you can limit elevation to, for example, a wall height from where it slopes down. Without reasonable accuracy this is currently very difficult. This would also solve 'starting with a set elevation': set the max and lift everything to that height.

I'm looking forward to see any or all in a next version!

Keet
[May 7, 2022, 3:08:17 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9133
Status: Offline
Reply to this Post  Reply with Quote 
Re: Terrain Generator plug-in

Here's the version 1.2 of the Terrain Generator plug-in which provides the following improvements:
- Magnetism was renamed as Multiple points and Alignment as Row modification
- Multiple points and Row modification states can also be toggled with check boxes (keyboard shortcuts still available)
- Undo / Redo buttons lets you undo / redo local changes (with 100 possible undo operations)
- The elevated grid point remains selected at screen after mouse button is released
- Elevation is editable to fine tune values
- It's possible to copy the current elevation on other points with a right click (or ctrl + click under macOS)
- When you draw a closed space with the right mouse button pressed (finishing on the point where you started), a dialog box is displayed to confirm whether all points within this space should be elevated (see demo video – 5 MB)
- Performances while elevating points were greatly improved
- The rotation around the vertical axis is done at the closest degree
- The length unit used in Influence radius spinner was fixed.



Hope this will satisfy most requests smile
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[May 23, 2022, 2:25:53 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Keet
Advanced Member
Member's Avatar

Netherlands
Joined: Apr 8, 2022
Post Count: 742
Status: Offline
Reply to this Post  Reply with Quote 
Re: Terrain Generator plug-in

Thank you! I'll be experimenting with this quite a lot the coming days.
[May 23, 2022, 2:42:46 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Daniels118
Advanced Member
Member's Avatar

Italy
Joined: Nov 17, 2021
Post Count: 398
Status: Offline
Reply to this Post  Reply with Quote 
Re: Terrain Generator plug-in

Hi Emmanuel, thank you for this new version! I have added it to the Plugin manager too.

A small bug (at least on Windows): when using the Alt and Shift keys to toggle the options, the checkbox is toggled on musedown, but it is toggled again on mouseup. Holding the key does not work (the checkbox blinks crazly).

Few suggestion for future improvements:
  • Add incremental mode, i.e. add a value (instead of override) to the current elevation while moving the mouse over the grid. (It should be allowed to set negative values too to dig the terrain).
  • Add smooth tool, would be helpful in conjunction with the new closed space function.

[May 24, 2022, 9:03:25 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Keet
Advanced Member
Member's Avatar

Netherlands
Joined: Apr 8, 2022
Post Count: 742
Status: Offline
Reply to this Post  Reply with Quote 
Re: Terrain Generator plug-in

(It should be allowed to set negative values too to dig the terrain).
Negative values are impossible since the terrain is generated from a room which is by default at elevation 0 on a level. Just like walls can't have a negative elevation.
That's why I requested the option to first raise the whole room to a single height after which you can lower parts.

Just create a level below your ground floor, lets say -250 and with a height of 250. Create the room and start the Terrain Generator. With a large scale and row modification lift everything above a 250 height. While you still see the blue point change the elevation value to 250 and you have a terrain evenly raised at 250 and level with your original ground level. Now you can both lower and raise the parts you want.

One 'bug' I noticed: After creating the terrain, walls that should show above the terrain (i.e. are higher than the terrain elevation) don't show in the 2D view but do in the 3D view. Not showing in the 2D view forces you to make the Terrain object invisible before you can do anything else simply because everything is otherwise hidden below the terrain. In my example with a 250 high terrain I had walls of 350 high for testing purposes that should have broken through the surface of the terrain and be visible but they don't.
I understand that is the way with all objects, maybe something like a 'Move to back' like in other programs that have overlapping objects is possible. I'm thinking about when you group objects: put a vase on a table and sometimes the vase doesn't show in the 2D view. Cut the vase and paste again and after regrouping it does show. So it depends on the order in which the objects are 'stacked'. Something should be possible with that knowledge but the same 'trick' doesn't work with the walls.
[May 24, 2022, 12:52:57 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9133
Status: Offline
Reply to this Post  Reply with Quote 
Re: Terrain Generator plug-in

Thanks for your feedback smile

Smoothing afterwards might be quite complicated to program to get nice results. Maybe one day…

And reordering the way things are drawn in the plan is a big development, and I’m not sure I want to change the current simple logic. You can also draw a room for your terrain which doesn’t include the walls or the house of the walls.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[May 25, 2022, 7:25:08 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Keet
Advanced Member
Member's Avatar

Netherlands
Joined: Apr 8, 2022
Post Count: 742
Status: Offline
Reply to this Post  Reply with Quote 
Re: Terrain Generator plug-in

First of all: the new Terrain Generator is a huge improvement, great work!

And reordering the way things are drawn in the plan is a big development, and I’m not sure I want to change the current simple logic. You can also draw a room for your terrain which doesn’t include the walls or the house of the walls.
I have a path through my terrain that swings all around so I use walls to create those. Manually drawing them would be a nightmare. That a room can exist without walls is a good thing for terrain building: after creating the paths with 0.1 thick walls and creating the rooms (including the 'path room') I remove the walls and create the terrain using all rooms. The result is that I have a path with a different texture that nicely follows the terrain elevation up and down, looks great! If walls were a requirement for a room to exist that would not be possible.

A test showed that a 350cm high wall hides under a 90cm high table laughing
I never realized it worked that way but it does explain why walls don't show through the terrain. It's based on elevation but doesn't take the height of the object into account for display in 2D.
As a workaround I'm thinking about a way to create a top view image of the terrain and set that as the texture of the room after hiding the terrain object. It ruins the 3D view but it is a way to see the terrain contours in the 2D view while designing without hiding the walls. Or maybe an extra level 1cm higher while designing and when finished lower it to the same level. I'll have to experiment with that.
[May 25, 2022, 11:04:33 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Daniels118
Advanced Member
Member's Avatar

Italy
Joined: Nov 17, 2021
Post Count: 398
Status: Offline
Reply to this Post  Reply with Quote 
Re: Terrain Generator plug-in

@keet
Negative values are impossible since the terrain is generated from a room which is by default at elevation 0 on a level. Just like walls can't have a negative elevation.

Just for clarity: I didn't mean negative elevation, but negative increment (i.e. decrement) when using such new feature "incremental mode". This would be intended to lower down points which already have a positive elevation; they would never go below zero anyway.
[May 26, 2022, 8:35:32 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
ankostis
Newbie



Greece
Joined: May 31, 2022
Post Count: 1
Status: Offline
Reply to this Post  Reply with Quote 
Re: Terrain Generator plug-in

Hello, thank you for your efforts.

Should i report here issues?
I'm receiving a NPE error when clicking the "Generate 3D teraain from rooms..." (i launched SH3D from console to see them):

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.eteks.sweethome3d.plugin.terraingenerator.RoomsTerrainGeneratorPlugin$5.getNextValue(Unknown Source)
at java.desktop/javax.swing.plaf.basic.BasicSpinnerUI.updateEnabledState(BasicSpinnerUI.java:510)
at java.desktop/javax.swing.plaf.basic.BasicSpinnerUI.updateEnabledState(BasicSpinnerUI.java:494)
at java.desktop/javax.swing.plaf.basic.BasicSpinnerUI$Handler.stateChanged(BasicSpinnerUI.java:1084)
at java.desktop/javax.swing.JSpinner.fireStateChanged(JSpinner.java:461)
at java.desktop/javax.swing.JSpinner$ModelListener.stateChanged(JSpinner.java:388)
at java.desktop/javax.swing.AbstractSpinnerModel.fireStateChanged(AbstractSpinnerModel.java:120)
at com.eteks.sweethome3d.swing.NullableSpinner$NullableSpinnerNumberModel.setValue(Unknown Source)
at com.eteks.sweethome3d.swing.NullableSpinner$NullableSpinnerLengthModel.setLength(Unknown Source)
at com.eteks.sweethome3d.plugin.terraingenerator.RoomsTerrainGeneratorPlugin.createComponents(Unknown Source)
at com.eteks.sweethome3d.plugin.terraingenerator.RoomsTerrainGeneratorPlugin.generateTerrain(Unknown Source)
at com.eteks.sweethome3d.plugin.terraingenerator.RoomsTerrainGeneratorPlugin.access$100(Unknown Source)
at com.eteks.sweethome3d.plugin.terraingenerator.RoomsTerrainGeneratorPlugin$1.execute(Unknown Source)
at com.eteks.sweethome3d.swing.HomePane$ActionAdapter.actionPerformed(Unknown Source)
at com.eteks.sweethome3d.swing.ResourceAction$AbstractDecoratedAction.actionPerformed(Unknown Source)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:369)
at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1020)
at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1064)
at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
at java.desktop/java.awt.Component.processMouseEvent(Component.java:6635)
at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
at java.desktop/java.awt.Component.processEvent(Component.java:6400)
at java.desktop/java.awt.Container.processEvent(Container.java:2263)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5011)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)



  • OS: Linux, Debian SID
  • SH3D: v6.6.2
  • TerainGenerator: v1.2
  • java: OpenJDK version 11.0.15 - 64bit - 0.2 / 7.8 GB provided by Debian
  • Java 3D: v1.5.2 - NATIVE_OGL

[May 31, 2022, 12:25:00 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Posts: 58   Pages: 6   [ Previous Page | 1 2 3 4 5 6 | Next Page ]
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

    Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads
   
© Copyright 2006-2024 eTeks - All rights reserved