It is currently Sun Jul 21, 2024 12:20 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: A million dollar question (Part 1)
PostPosted: Mon Jul 15, 2013 1:17 pm  (#1) 
Offline
GimpChat Member
User avatar

Joined: Sep 22, 2012
Posts: 2089
Location: US
OK, this is a long story...

I have these images here rendered in 3ds max - one is PNG (no alpha), the other one is TAGRA (.tga) as a Z-depth map.

Image

Image


Sorry, tagra isn't acceptable on GC, what you see is jpg image, so i'm attaching .tga

Attachment:
File comment: Zipped TAGRA depth map
Zdepth_map_TGA.zip [232.27 KiB]
Downloaded 169 times



The question is: how can one make tagra image* an alpha channel of the PNG image in GIMP
(in other words, to make a depth map an alpha channel of PNG image)
?

I seem to have tried all possible ways to do so but not sure gimp is capable of doing it.

What I add as a new channel in GIMP does affect RGB channels, and that is not supposed to happen (as an argument I can refer to the same procedure in Photoshop).

One can suggest to add tga image as a layer mask but it would not do the trick (I will explain later but for now it's better off to keep it undisclosed - might be part 2 of the million dollar question)

Thanks.

P.S. I have obviously managed to add .tga file as a channel playing with the opasity values in gimp but it
is not a true alpha channel as it affects the original image in a destructive way.

Image

P.P.S. *tagra or jpg format - isn't really important in this case.


Last edited by K1TesseraEna on Mon Jul 15, 2013 1:30 pm, edited 1 time in total.

Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: A million dollar question (Part 1)
PostPosted: Mon Jul 15, 2013 1:30 pm  (#2) 
Offline
GimpChat Member
User avatar

Joined: Jan 03, 2011
Posts: 1656
Not sure how to do this with GIMP, I used the CLI version of G'MIC to do it.
See attached file.

Attachment:
2205.png
2205.png [ 1.63 MiB | Viewed 4005 times ]


Top
 Post subject: Re: A million dollar question (Part 1)
PostPosted: Mon Jul 15, 2013 1:42 pm  (#3) 
Offline
GimpChat Member
User avatar

Joined: Sep 22, 2012
Posts: 2089
Location: US
Thanks, David. What you refer to CLI is the command line operation, right?
Well, as I can see the resulting image is also affected (inversive to what i've got in GIMP).
The thing is, PS adds the tagra depth map as an alpha channel without affecting the original
image.
What the alpha depth is needed for is the possibility to create cameras variable DOF effect
like this one.

Image


Top
 Post subject: Re: A million dollar question (Part 1)
PostPosted: Mon Jul 15, 2013 1:55 pm  (#4) 
Offline
Global Moderator
User avatar

Joined: Nov 16, 2011
Posts: 5128
Location: Metro Vancouver, BC
XnView reads and writes Targa files, check its image menu for possible options.

_________________
Image
Gimp 2.8.18, Linux, median user
Gimp Chat Tutorials Index
Spirit Bear (Kermode)


Top
 Post subject: Re: A million dollar question (Part 1)
PostPosted: Mon Jul 15, 2013 1:55 pm  (#5) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2013
Posts: 462
Location: Stockholm
This rocks I made few year ago on Blender 2.5 Interial.
Image

_________________
Late 2017 iMac Retina 4K 21,5 inch Mac OS High Sierra version 10.13.4
3,6 GHz Intel Core i7
16 GB Ram 2400 MHz DDR4
Graphic card Radeon Pro 560 4096 MB
Affinity Photo and Affinity Designers.


Top
 Post subject: Re: A million dollar question (Part 1)
PostPosted: Mon Jul 15, 2013 2:01 pm  (#6) 
Offline
GimpChat Member
User avatar

Joined: Sep 22, 2012
Posts: 2089
Location: US
Odinbc wrote:
XnView reads and writes Targa files, check its image menu for possible options.


GIMP supports tga files without any problem, that's not what's in question here, Odin.


Top
 Post subject: Re: A million dollar question (Part 1)
PostPosted: Mon Jul 15, 2013 2:06 pm  (#7) 
Offline
GimpChat Member
User avatar

Joined: Sep 22, 2012
Posts: 2089
Location: US
It's good, Lurifax, the question is about GIMP, not Blender or any other 3d app.
I'll come back later with more pictures of what i'm trying to resolve here.
Sorry, if i didn't make it very clear from the start, but it seems confusing for many to get what i'm after.


Top
 Post subject: Re: A million dollar question (Part 1)
PostPosted: Mon Jul 15, 2013 2:29 pm  (#8) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
* Open PNG image
* Open As Layers TGA image
* Edit->Cut
* Layer->Mask->Add Layer Mask
* Edit->Paste
* Layer->Anchor Layer
* Layer->Mask->Apply Layer Mask

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: A million dollar question (Part 1)
PostPosted: Mon Jul 15, 2013 2:40 pm  (#9) 
Offline
GimpChat Member
User avatar

Joined: Sep 22, 2012
Posts: 2089
Location: US
Thanks, sg!
I had no problem with creating a layer mask. That was the first thing i tried.

Here

K1TesseraEna wrote:

One can suggest to add tga image as a layer mask but it would not do the trick (I will explain later but for now it's better off to keep it undisclosed - might be part 2 of the million dollar question)


Top
 Post subject: Re: A million dollar question (Part 1)
PostPosted: Mon Jul 15, 2013 3:09 pm  (#10) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4757
saulgoode wrote:
* Open PNG image
* Open As Layers TGA image
* Edit->Cut
* Layer->Mask->Add Layer Mask
* Edit->Paste
* Layer->Anchor Layer
* Layer->Mask->Apply Layer Mask

Slightly simpler solution:
* Open As Layers TGA image
* In Channels drag any of the RGB channels to make a copy
* Layer->Mask->Add Layer Mask, use the copied channel
* Layer->Mask->Apply Layer Mask

_________________
Image


Top
 Post subject: Re: A million dollar question (Part 1)
PostPosted: Mon Jul 15, 2013 4:26 pm  (#11) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
K1TesseraEna wrote:
[font=Tahoma]
Well, as I can see the resulting image is also affected (inversive to what i've got in GIMP).
The thing is, PS adds the tagra depth map as an alpha channel without affecting the original
image.
What the alpha depth is needed for is the possibility to create cameras variable DOF effect
like this one.


Maybe the image is not affected as may seems:
just place a black (or dark grey) layer behind, and should again look identical

As you know the alpha channel is NORMALLY used for transparency, and change in the transparency will always change the look
(except if you correct adding a layer behind )

BUT in your case the alpha channel will be used to store a depthmap , not to calculate transparency so should be no problems





--------------------------------------

In case you don't find another solution should be trivial wrote a little gmic filter to do it

But again if is read as was the "alpha" of RGBA, for sure the Z-buffer will modify the image
THE POINT is the alpha will be read as a depthmap for DOF , and not as normally used, to calculate transparency

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Last edited by PhotoComix on Mon Jul 15, 2013 4:44 pm, edited 2 times in total.

Top
 Post subject: Re: A million dollar question (Part 1)
PostPosted: Mon Jul 15, 2013 4:35 pm  (#12) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12535
Apologize K1Te; couldn't help myself (yes; a stereogram). :)


Attachments:
chm.jpg
chm.jpg [ 640.21 KiB | Viewed 2562 times ]

_________________
Lyle

Psalm 109:8

Image
Top
 Post subject: Re: A million dollar question (Part 1)
PostPosted: Mon Jul 15, 2013 6:28 pm  (#13) 
Offline
GimpChat Member
User avatar

Joined: Sep 22, 2012
Posts: 2089
Location: US
LOL. Thanks, Lyle! Been playing myself with some depth maps I've made in
Blender and 3ds max. Using Stereogram Maker. What program are you on?


Top
 Post subject: Re: A million dollar question (Part 1)
PostPosted: Mon Jul 15, 2013 6:42 pm  (#14) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12535
GIMP's magiceye plugin. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: A million dollar question (Part 1)
PostPosted: Mon Jul 15, 2013 7:10 pm  (#15) 
Offline
GimpChat Member
User avatar

Joined: Sep 22, 2012
Posts: 2089
Location: US
OK now, this is what i actually need.

To create depth of field effect in image rendered with 3D application.
Here's the workflow:
Render image in Blender (image #1 in OP, PNG)
Render depth map (image #2, TGA)
Both steps could be done with Blender, 3ds max, Cinema4d, etc.

Open both files in PS and add depth map as an alpha channel to PNG.

Image

Using PS Lens Blur filter and alpha channel as a Depth Map, change 'in focus' depth by sliding Blur Focal Distance controller.

Image

I've made APNG animation out of the image sequence to demonstrate how the depth map works.
This technique is being used to create videoFX from a single shot.
In After Effects it could be done in one go just using single image with zdepth alpha channel.


Image

Creating amateur DOF effect in GIMP could be done by duplicating bg layer, blurring it, adding layer mask and
applying b/w gradient to that mask. This may actually work for the images without objects obliterating each
other along Z axis (depth). But in most cases it looks creepy.

Obviously, GIMP does not have the default Lens Blur plugin. 3rd party Focus Blur seems to be a
plugin of choice here but that's Part 2 of the million dollar question :)

`


Top
 Post subject: Re: A million dollar question (Part 1)
PostPosted: Mon Jul 15, 2013 8:17 pm  (#16) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
Not sure for Gimp but that should be be possible with Gmic

One of the Gmic filter contributors ,Tom Keil did already some cool filters for 3d effects and animations may be interested

I don't think he follows gimpchat but if you post a request on the gmic group on flickr he will see

EDIT
i am not speaking of the Focus blur, but of the all the process you describe

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Post subject: Re: A million dollar question (Part 1)
PostPosted: Mon Jul 15, 2013 8:33 pm  (#17) 
Offline
GimpChat Member
User avatar

Joined: Sep 22, 2012
Posts: 2089
Location: US
PhotoComix wrote:
Not sure for Gimp but that should be be possible with Gmic

One of the Gmic filter contributors ,Tom Keil did already some cool filters for 3d effects and animations may be interested

I don't think he follows gimpchat but if you post a request on the gmic group on flickr he will see

EDIT
i am not speaking of the Focus blur, but of the all the process you describe


Thanks, PC! I'm at my sister's now (means no GIMP,)
using her access to Adobe CC, but will check out GMIC as soon as i get home.


Top
 Post subject: Re: A million dollar question (Part 1)
PostPosted: Mon Jul 15, 2013 8:52 pm  (#18) 
Offline
GimpChat Member
User avatar

Joined: Sep 22, 2012
Posts: 2089
Location: US
Ronounours wrote:
Not sure how to do this with GIMP, I used the CLI version of G'MIC to do it.
See attached file.

Attachment:
2205.png


Hey, David! I like the 'fog' effect in your image!
Could be a cool idea for a GMIC mist/fog filter using depth map, don't you think?


Top
 Post subject: Re: A million dollar question (Part 1)
PostPosted: Mon Jul 15, 2013 9:09 pm  (#19) 
Offline
GimpChat Member
User avatar

Joined: Sep 22, 2012
Posts: 2089
Location: US
here's slightly improved apng animation

Image


Top
 Post subject: Re: A million dollar question (Part 1)
PostPosted: Mon Jul 15, 2013 9:15 pm  (#20) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14715
Location: USA
That is a really neat effect. :)

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts The other part of our Universe! Spacescape2.py

5

No new posts Coin Tutorial Part 2

3

No new posts Attachment(s) [SOLVED] Delete large part of path?

4

No new posts Attachment(s) New Guide to FontSlab Part 5: Repeats and Reversals

1

No new posts Attachment(s) Custom Font Tools Part Update

2



* Login  



Powered by phpBB3 © phpBB Group