The Big Bad G'MIC Thread of Silly Questions

Part of it.

Here’s a hint:

{[image_w] | width>0[%]},_{[image_h] | height>0[%]},_{[image_d] | depth>0[%]},_{[image_s] | spectrum>0[%]},_interpolation,
_boundary_conditions,_ax,_ay,_az,_ac

1 Like

I see… didn’t know about this. will probably save some lines :slight_smile:

Feeding uglify with some wood

Original

3 Likes

I feel like you’re on a huge step up. That’s great output.

Hello, i have a question!

Below is a “simplification” of underwoods (questions inside):

treeCount:=v(100)
R:=round($treeCount/2)
 repeat $R {
      T:=$>+1
        repeat 2 {
      # I want to modify WIDTH & HEIGHT below
      # so that trees in the back are smaller & thinner than in the front? 
      # Note that Width & Height use a -1,1 range,
      # so it's a bit tricky for me since i use $> and anything
       #below 0 just fail:
     fx_tree[0] 10,0,WIDTH,HEIGHT,10,200,0,2,.8,-10,10,50,75,0,70,20,0,0,0,255,100,0,0,0,255,100,.4,.4
          }
   =>.. Tree$T
   =>.. Tree1$T  # don't ask me, it's just easier for me to find them...
  l[Tree$T,Tree1$T,Bush] {
  # lots of stuff happening here, then
  # let's save some resources, 
  #shadows double up the size of the images:
blend[Tree$T,Tree1$T] alpha,1 
  }
    # i'm trying to move the trees up to simulate depth. 
    # Trees in the back go up. Kinda works :
    TY:=$<*(-$treeCount*.2/$R) # Don't ask me lol
    # will probably add a slider for this ".2" above.
    ja[BG] [Tree$T],0,$TY,0,0,1
    rm[Tree$T]
}

How would you do this? I have something that seem to work (not even sure about this) but probably not pretty.

EDIT: OH great, pressed spacebar and message fot posted instead .

Why not add to or subtract from count to get the desired value? Or you could do that in-place: {[WIDTH,HEIGHT]*factor+offset}, for example.

Well, i have this :

if $treeH>=0 TH:=1-$T/($treeCount*.5) else TH:=1+$T/($treeCount*.5) fi
TW:=1+($T/$treeCount)

fx_tree[TSIZE] $treeComp,0,{(u($treeW*.95,$treeW)/$TW)-1},{u($treeH*.95,$treeH)*$TH},10,200,0,2,.8,-10,10,50,75,0,70,20,$trunR,$trunG,$trunB,255,$trunO,$leafR,$leafG,$leafB,255,$leafO,.4,.4

and then i get this :
image
Yup, getting hard to tell what’s going on… This is positive height.
Below is negative height:
image

So i got it reversed it seems. I do so many experiments that i don’t know what i’m doing anymore. Brains not working right i guess.

Simplifying the visuals makes it clezar it’s not working:

I guess what you can do is to use scaled new image?

mmm this would slow things down i think?
Edit : and then i’d have to recalculate the position for ja? <I’m not even sure of this anyway, it could be shifted up automatically. mmm.
But I’d rather generate the tree at the right size.
Actually the tree height is not equal to the image size.
Tree height = 1 is really going out of the border (that’s fine, depends on what you want to see) :


Smaller trees in the front? no way :frowning:

Of course, if it was 3D, i wouldn’t have this maths headache… But i don’t think 3d planes can use alpha textures ( it’s black).

If you are going for realism, then larger trees are surrounded by less trees. Other brush are sparsely placed, but could be more abundant at the edges of the lot. Front row does not have to be shorter than back row, since trees tend to vary in height anyway.

Good to know. Not sure i’d go that far. I wouldn’t know how to do that anyway.

But i want to add a little bit of depth.

I actuially want them to be taller in the front row, and smaller in the back, to simulate perspective and depth. ( and yes, i use varying sizes)

I edited the post a slightly while you were replying.

Oh, as a bonus, maybe have an Easter egg, e.g., a little rabbit somewhere (reference intended). :wink:

PS - these posts should probably be in the filter’s thread.

yes, i thought about that. A random encounter that appears every now and then.
A rabbit, or Sadako, i don’t know. Both can kill you in seconds, i guess.

Nah, who cares about this. The filter’s thread is for fun or updates, not for headaches.

BTW, is there an expand equivalent to autocrop? To autoexpand?

Alright, tried this and it didn’t go so well.
it doesn’t work since the tress are shifted in position, sp they m ay be cut in half and moved to the sides, so scaling the images will just show ugly clipping.

Even for one or a few files, set them up in a git repository (git init; git add --all; git commit -m "Here begins recorded history.") and commit often with a brief, synopsis messages addressed to your future self (Don’t do “.” synopses! Your future self will thank you) . Every commit is a snapshot. git log replays your synopses, along with commit hashes. git diff <hash>.. <subsequent hash> displays ± differences between the two commits. the hashes need not be adjacent and may be abbreviated to the first four to eight characters — you only need to write enough of hashes to establish uniqueness. If you discover that your line of effort is turning out fruitless, then:

$ git branch newidea df5ccdf6  # <-- hash of last 'sane' commit. Could be from a few days ago...
$ git switch newidea
Switched to branch 'newidea'

sends you back in time to when you were still sane, to a branch point that you’ve just named newidea. All your fruitless edits revert — disappear from your workspace, though they are still on the branch you have departed (let’s say that branch is named mainline.) Having branched off of mainline to newidea you can develop along an alternate scheme. You can always switch back to mainline if newidea doesn’t work out. Or start off other branches elsewhere. Every wild-eyed experiment can go on its own branch, and you can switch to it anytime from anywhere else in your project. See the SCM manual.

There is no sane reason not to learn this basic, effective tool — especially now that your work is becoming non-trivial. The ability to backtrack-and-retrack is immeasurably valuable. Don’t put it off to this weekend or when you’re “no so busy.” Do it now.

Thanks for the tip. I just feel like i have a ton of stuff to learn, don’t know where to start, (don’t know why either), and have lost all my patience a long time ago.

I usually just duplicate a line, comment the old one and modify the new one, in place. It’s just when i have to use maths, my mind goes blank, and i don’t really know what to use to do what i want to do.

Still haven’t found a solution for the height problem, but then yesterday it took me just 2 minutes to write this idea :
{floor($treeComp^($T/$R))}
$T is just $>+1, $R number of loops, $treeComp being complexity.
Results below.

Test
gmic run 'repeat 45 { echo {floor(15^((1+$>)/45))} }' 
[gmic]./ Start G'MIC interpreter (v.3.3.6).
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
3
3
3
3
3
4
4
4
5
5
5
6
6
6
7
7
8
8
9
9
10
11
11
12
13
14
15
[gmic]./ End G'MIC interpreter.


Ugly? Yes. What am i doing? Don’t know. It works though.

Which gives me a LOD effect : Trees in the back are less detailed than the front.
And i have no idea how i came up with this, really. It just happened. There’s probably too many parenthesis though. :sweat_smile:
What i mean is, when i want to, i can’t, and when i just do stuff without thinking, it works. And now i don’t know how to adjust this so it doesn’t start too low… sigh.
At least it’s useful when tere are a lot of trees, saves some time ( can’t really reuse trees with current code). Anyway, will make it optional, as usual.

1 Like

Is this normal ?

When i run this in my terminal :

 gmic sp tiger,lena,david store 1,img input $img
[gmic]./ Start G'MIC interpreter (v.3.3.6).
[gmic]./ Input sample image 'tiger' (1 image 750x500x1x3).
[gmic]./ Input sample image 'lena' (1 image 512x512x1x3).
[gmic]./ Input sample image 'david' (1 image 800x600x1x3).
[gmic]./ Store images [0,1,2] as compressedvariable 'img'
[gmic]./ Input file '' at position 0
[gmic]./ *** Error *** Command 'input': Unknown filename ''.

Tried this as a last resort and it works :
gmic run 'sp tiger,lena,david store 1,img $img'

EDIT: i guess it is normal, since this does not work either :

gmic x=test echo $x
[gmic]./ Start G'MIC interpreter (v.3.3.6).
[gmic]./ Set local variable 'x=test'.

[gmic]./ End G'MIC interpreter.

OK found out i have to use quotes or {} in the terminal:
gmic sp tiger,lena,david store 1,img '$img'

gmic x=test echo '$x'
[gmic]./ Start G'MIC interpreter (v.3.3.6).
[gmic]./ Set local variable 'x=test'.
test
[gmic]./ End G'MIC interpreter.

Your second example would work in Windows CMD. Terminal rules are very strict, man. That’s pretty much all I have to say, and with emphasis on man in figure of speech kind of thing.