Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Auto Rotating Trees & Shrubs

vfrontiers
Advocate
Has anyone noticed that the trees and shrub rotate PERPENDICULAR to the CAMERA's own rotation? and not the line between the camera and the object?

I have spent an hour trying to debug... I know I should just be able to change their dx and dy to a line that runs from EYE_POS to SYMB_POS... but I can't get it to work...

I have done this myself since about ArchiCAD 6.5... But with all the extra steps and code in these objects, I've had no luck..

Can someone at least back me up that the Auto Rotation should be based on the line between camera eye and object rather than camera eye and camera target...??

If you can crack the code, please let me know how...
Duane

Visual Frontiers

AC25 :|: AC26 :|: AC27
:|: Enscape3.4:|:TwinMotion

DellXPS 4.7ghz i7:|: 8gb GPU 1070ti / Alienware M18 Laptop
8 REPLIES 8
David Maudlin
Rockstar
Duane:

I don't think the behavior has changed for the ArchiCAD parts, it uses the Camera's position and target for the rotation. I looked at the AC 10 Tree Bitmap 10, and it has the code:
dx= k~ - n~ (k~ = GLOB_EYEPOS_X, n~ = GLOB_TARGPOS_X [Old Global Variables])
The AC19 Deciduous Trees 19 has the code:
dx = GLOB_EYEPOS_X - GLOB_TARGPOS_X
so the parts should work the same way.

If you post the object you are working on (not just the code snippet which makes recreating the way the object works difficult) maybe someone will see the issue to get the object rotating to face the Camera.

David
David Maudlin / Architect
www.davidmaudlin.com
Digital Architecture
AC27 USA • iMac 27" 4.0GHz Quad-core i7 OSX11 | 24 gb ram • MacBook Pro M3 Pro | 36 gb ram OSX14
vfrontiers
Advocate
So... I created an EASY object to tip a PICTURE up and face camera...

This is the ENTIRE 3d SCRIPT
+++++++++

Rotz (90-ATN((SYMB_POS_X-GLOB_EYEPOS_X)/(SYMB_POS_Y-GLOB_EYEPOS_Y)))+(90-SYMB_ROTANGLE)

hotspot 0,0,0
hotspot -a/2,0,0
hotspot -a/2,0,zzyzx
Hotspot a/2,0,zzyzx
hotspot a/2,0,0

hotspot 0,0,zzyzx/2


Rotx 90

addx -a/2
picture gs_picture_name, a,zzyzx,1+0
+++++++++++++

It does NOT consider MIRRORING.. I just need it to work for now...

Works like a champ.. Even builds it's own LIST OF AVAILABLE jpg's in a pull down menu if you use the "gs_picture_name" parameter.

But... when you go to C4D rendering.. the DEFAULT material for the object get's used instead of the PICTURE in the picture command..
Funny thing is that it maintains the shape of the ALPHA CHANNEL!

I see that the TREE objects and the TV object convert the IMAGE FILE into a MATERIAL and apply to a rect... which seems to render fine.
But using the PICTURE command does not... see screenshot below

Any help is appreciated...
Screen Shot 2017-01-01 at 2.33.24 PM copy.jpg
Duane

Visual Frontiers

AC25 :|: AC26 :|: AC27
:|: Enscape3.4:|:TwinMotion

DellXPS 4.7ghz i7:|: 8gb GPU 1070ti / Alienware M18 Laptop
David Maudlin
Rockstar
Duane:

I ran into a similar problem a few years ago. I was able to fix it by adding the code:
Material 0
before the Picture command. This may not be best practice, but worked in my case.

David
David Maudlin / Architect
www.davidmaudlin.com
Digital Architecture
AC27 USA • iMac 27" 4.0GHz Quad-core i7 OSX11 | 24 gb ram • MacBook Pro M3 Pro | 36 gb ram OSX14
vfrontiers
Advocate
You're a genius!

Best practice or not... it worked...

And it reinforces my suspicion that the GS parts can get so over inflated with code...

Honestly... those 10 lines of codes (and 5 lines were to create hotspots) does the same thing as their 4 pages of code...
Duane

Visual Frontiers

AC25 :|: AC26 :|: AC27
:|: Enscape3.4:|:TwinMotion

DellXPS 4.7ghz i7:|: 8gb GPU 1070ti / Alienware M18 Laptop
Anonymous
Not applicable
vfrontiers wrote:
You're a genius!

Best practice or not... it worked...

And it reinforces my suspicion that the GS parts can get so over inflated with code...

Honestly... those 10 lines of codes (and 5 lines were to create hotspots) does the same thing as their 4 pages of code...
Hi very nice object.

Is there a way to update rotation to the camera automatically just before rendering? or we just have to select all objects and open settings dialog to update?
David Maudlin
Rockstar
ispyridis wrote:
Is there a way to update rotation to the camera automatically just before rendering? or we just have to select all objects and open settings dialog to update?
There is a command Rebuild & Regenerate that will run the script to get the Object to rotate to the Camera.

David
David Maudlin / Architect
www.davidmaudlin.com
Digital Architecture
AC27 USA • iMac 27" 4.0GHz Quad-core i7 OSX11 | 24 gb ram • MacBook Pro M3 Pro | 36 gb ram OSX14
vfrontiers
Advocate
ispyridis wrote:

Hi very nice object.

Is there a way to update rotation to the camera automatically just before rendering? or we just have to select all objects and open settings dialog to update?
So ONE time... out of the many renders I've been doing over the past couple of months, I did notice the plants shift just before the render engine engaged..

But typically ... it doesn't...

But the 2 methods I use are these...

a. Create a DUPLICATE LAYER SET that turns off the Plant Layers
- Toggle them OFF, then ON using the quick layers palette

b. Select all OBJECTS and ELEVATE 0"
- The thing about just opening the dialog is that if you select object that DON'T auto rotate and it's your "last selection"... the auto rotate object will NOT UPDATE... (Let me know if that makes sense)

Anyway... I'm back on track...

ALSO... I used to laugh at PINTREST but upon joining, I have found a TON of fresh CUTOUT TREES and SHRUBS to include in my library.

I just wish there was a way to define WHICH FOLDERS the automatic pull down menu looks in... As I've got a bunch of TV Screens, Backgrounds, Artwork...etc) So you might want to be creative with your naming to group them together in this list.

I also found a very short tutorial on how to make an ALPHA CHANNEL in Photoshop ELEMENTS... Let me know if anyone is interested.
Duane

Visual Frontiers

AC25 :|: AC26 :|: AC27
:|: Enscape3.4:|:TwinMotion

DellXPS 4.7ghz i7:|: 8gb GPU 1070ti / Alienware M18 Laptop
vistasp
Advisor
vfrontiers wrote:

ALSO... I used to laugh at PINTREST but upon joining, I have found a TON of fresh CUTOUT TREES and SHRUBS to include in my library.
Wow! That's almost as useful as your code! Would never have thought to look there. A double thank you, Duane.

And thank you too, David, for that Material 0 trick!
= v i s t a s p =
bT Square Peg
https://archicadstuff.blogspot.com
https://www.btsquarepeg.com
| AC 9-27 INT | Win11 | Ryzen 5700 | 32 GB | RTX 3050 |