Author Topic: Opacity tex comparison  (Read 12488 times)

2014-06-20, 16:26:43

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 6581
  • Let's move this topic, shall we?
    • View Profile
    • My Models
I was making some foliage textures for personal use recently. Saved all maps to png format and begin to construct material. Soon enough i found that my material performs rather poor in therms of speed. Naturally, i blamed opacity map. Tried different tricks, but nothing really helped. So i decided to resave opacity texture to other format and to my surprise, i saw significant improvement. All other formats rendered much quicker... all except png and gif. Later i found out that transparency in those formats is what causing problems. But most interestingly is that gif saved without transparency shows massive improvement in render speed! So from now on, i'll use gif for opacity maps exclusively.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2014-06-20, 16:57:53
Reply #1

Ondra

  • Administrator
  • Active Users
  • *****
  • Posts: 8913
  • Turning coffee to features since 2009
    • View Profile
this is interesting, can you send me this particular scene and the maps so I can run some tests?
Rendering is magic.
Private scene uploader | How to get minidumps for crashed/frozen 3ds Max | Sorry for short replies, brief responses = more time to develop Corona ;)

2014-06-20, 17:20:21
Reply #2

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 6581
  • Let's move this topic, shall we?
    • View Profile
    • My Models
Done!
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2014-06-20, 17:51:19
Reply #3

borisquezadaa

  • Active Users
  • **
  • Posts: 615
    • View Profile
Now that's something interesting!.

Good to know.
What i do with Corona My Corona post of random stuff rendering
WARNING: English.dll still loading...

2014-06-20, 18:06:51
Reply #4

Siahpoosh

  • Active Users
  • **
  • Posts: 141
    • View Profile
    • Siahpoosh.Net
very useful , thank u

2014-06-20, 18:22:45
Reply #5

steyin

  • Active Users
  • **
  • Posts: 362
  • BALLS
    • View Profile
    • Instagram Page
Curiouser and curiouser.

2014-06-20, 18:24:36
Reply #6

kahein

  • Active Users
  • **
  • Posts: 184
    • View Profile
thank you for this, very useful
Asus Z10PE-D16 WS / Dual Xeon E5-2690 v4 @ 2.60GHz / RAM 64 Go - GTX 970
Win 10 / Max 2017 / Corona 1.4

2014-06-20, 19:01:10
Reply #7

Siahpoosh

  • Active Users
  • **
  • Posts: 141
    • View Profile
    • Siahpoosh.Net
maybe this is because the informations in those formats , for example you will lost a lot of data in GIF file or u have more data in PNG file (RGB+alpha) somthing like this :
PNG(8bit) > BMP(8bit) > GIF
« Last Edit: 2014-06-20, 19:05:24 by vrMan »

2014-06-20, 21:41:55
Reply #8

Tweekazoid

  • Active Users
  • **
  • Posts: 59
    • View Profile
    • personal CG and scripting stuff also few pictures
if you are interested in further testing, try comparing PNG with and without comprimation, as well as with and without interlacing...
I think the difference why it performs this way for each format is inherently in file format structure itself. Gif uses structure that can be read as 1 pixel at a time and does not relly on decoding other parts of file (with the exception of instructions). So my guess would be that it saves time by reducing the need for buffer. And maybe I am completely wrong

2014-06-20, 21:48:20
Reply #9

Ondra

  • Administrator
  • Active Users
  • *****
  • Posts: 8913
  • Turning coffee to features since 2009
    • View Profile
If max REALLY decodes the original compressed format every time a texture is accessed, then I need to write CoronaMap ASAP. 
Rendering is magic.
Private scene uploader | How to get minidumps for crashed/frozen 3ds Max | Sorry for short replies, brief responses = more time to develop Corona ;)

2014-06-21, 03:22:04
Reply #10

rampally

  • Active Users
  • **
  • Posts: 208
    • View Profile
If max REALLY decodes the original compressed format every time a texture is accessed, then I need to write CoronaMap ASAP.
that's another great news Keymaster
i was supposed to ask this question today mean while i saw this .. great

2014-06-21, 03:42:50
Reply #11

Juraj

  • Active Users
  • **
  • Posts: 4079
    • View Profile
    • studio website
Definitely stirred my curiousity. I don't think there's way to measure this as easily in other renderers, to definitely pinpoint this as 3dsMax fault ?

And if so, I echo Tweekazoi's plea: Compare PNG based on comprimation (with and without), or alpha channel.

With Vray, I use purely .png for some sort of stuff(like foliage :- D), usually without comprimation, although over the time, I can't really remember if all of them are so.
talcikdemovicova.com  Website and blog
be.net/jurajtalcik   Our studio Behance portfolio
Instagram   Our studio Instagram, managed by Veronika

2014-06-21, 11:07:32
Reply #12

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 6581
  • Let's move this topic, shall we?
    • View Profile
    • My Models
I don't know what that comprimation is, you talking about, i guess it's compression, right? Anyway, i did some more tests as requested. Everything is saved from photoshop, source file doesn't contain any layers nor alpha channels (gif and png doesn't support alpha channel anyway). Bmp is provided for reference.
Results are quite confusing, at least for me:
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2014-06-21, 11:45:54
Reply #13

Ludvik Koutny

  • VIP
  • Active Users
  • ***
  • Posts: 2562
  • Just another user
    • View Profile
    • My Portfolio
I never ever used opacity from alpha. Always from an 8bit bitmap without alpha channel, so that's why i probably never ran into this issue.

I think that results of those tests are not confusing at all. They are actually quite simple to figure out. Best way seems  to be using 8bit opacity maps without any alpha channel.

2014-06-21, 11:48:16
Reply #14

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 6581
  • Let's move this topic, shall we?
    • View Profile
    • My Models
Rawalanche, all these maps are 8 bits without alpha channel.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2014-06-21, 12:00:15
Reply #15

Ludvik Koutny

  • VIP
  • Active Users
  • ***
  • Posts: 2562
  • Just another user
    • View Profile
    • My Portfolio
Rawalanche, all these maps are 8 bits without alpha channel.

Then what's that transparency off/on? O_o

2014-06-21, 12:47:19
Reply #16

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 6581
  • Let's move this topic, shall we?
    • View Profile
    • My Models
It's an option in photoshop "save as..." or "save for web..." dialog. But as i stated earlier my source file don't have alpha channels.
I can give you two gif files. One is saved with transparency "on", other with "off". Both have very similar file size and are indistinguishable in ps, but gives very different results when used as opacity maps.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2014-06-21, 12:52:51
Reply #17

Ondra

  • Administrator
  • Active Users
  • *****
  • Posts: 8913
  • Turning coffee to features since 2009
    • View Profile
Can you test it also with vray/scanline/mental ray?
Rendering is magic.
Private scene uploader | How to get minidumps for crashed/frozen 3ds Max | Sorry for short replies, brief responses = more time to develop Corona ;)

2014-06-21, 13:01:48
Reply #18

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 6581
  • Let's move this topic, shall we?
    • View Profile
    • My Models
scanline/mr - yes, i'll do it later, but i don't have vray.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2014-06-21, 13:14:01
Reply #19

Ludvik Koutny

  • VIP
  • Active Users
  • ***
  • Posts: 2562
  • Just another user
    • View Profile
    • My Portfolio
Oh, no, that IS alpha i believe.

The only thing is that Photoshop interprets it as transparency for some formats. Simply because it's easier to explain to non technical users that something is transparent, than that is has an alpha channel they may never heard about.

Here's for example what you get when you save PNG out of max:


So, everything actually makes sense. Opacity is very, very expensive calculation. It does not just calculate some effect of a material. It calculates if ray has to evaluate the surface or pass through as if nothing happened. And that often happens more than once in a ray path. So any overhead in this very expensive and very often performed calculation will result in a significant slowdown.

Larger bit depth (16bit) = more data to process
Additional channel instead of standard RGB = more data to process

So it actually makes sense.

I usually use just JPEGs for my opacity maps. There i am sure it can not carry high bit depth nor it can carry any sort of alpha/transparency channel. That's probably why i never ran into any problems.

2014-06-21, 14:28:23
Reply #20

Siahpoosh

  • Active Users
  • **
  • Posts: 141
    • View Profile
    • Siahpoosh.Net
If max REALLY decodes the original compressed format every time a texture is accessed, then I need to write CoronaMap ASAP.
+ for CoronaMap

Edit : i think this is why Arnold created .tx format for textures :



https://support.solidangle.com/display/AFMUG/Textures
« Last Edit: 2014-06-21, 14:38:30 by vrMan »

2014-06-21, 14:28:54
Reply #21

Juraj

  • Active Users
  • **
  • Posts: 4079
    • View Profile
    • studio website
I was asking about the above chart only as well. Sorry if my word for compression was confusing, I don't know why I stuck with it.

Basically, 8bit (per channel, so RGB24) with/without Alpha channel and 16bit(RGB48) with and without Alpha channel.
And those, with and without compression. But you already proved compression doesn't matter. Good to know. So it all seems to be about bitdepth and alpha channel

I guess we're talking purely about opacity slot right now right ? If so I use 8bit/without alpha, but I still keep the diffuse one as 8bit with alpha (might be pure bullshit, but even if that alpha isn't used, I've noticed better result in Vray? )

Maybe I should give it a try and replicate in Vray.
talcikdemovicova.com  Website and blog
be.net/jurajtalcik   Our studio Behance portfolio
Instagram   Our studio Instagram, managed by Veronika

2014-06-21, 16:11:34
Reply #22

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 6581
  • Let's move this topic, shall we?
    • View Profile
    • My Models
The results of this test is geting ridiculous. I don't have much technical knowledge nor my english is good enough to feel comfortable in such discussion, so i'll leave you with plain numbers. Just a little explanation: i used 2 gif images as opacity map, both saved in photoshop via "save as..." dialog. One of them has transparency enabled, other hasn't. All materials are simple lambertian mats with only map in opacity slot (cutout in case of MR).

p.s. this is not comparison between renderers  in terms of speed!!!
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2014-06-21, 17:07:32
Reply #23

lacilaci

  • Active Users
  • **
  • Posts: 755
    • View Profile
You guys use unfiltered maps for opacity right? Or doesn't filtering play any role in this?

2014-06-21, 20:04:00
Reply #24

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 6581
  • Let's move this topic, shall we?
    • View Profile
    • My Models
Filtering of opacity maps is disabled in Corona by default.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2014-06-22, 21:01:45
Reply #25

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 6581
  • Let's move this topic, shall we?
    • View Profile
    • My Models
To add to a confusion even more, i found that pngs saved in PS via "save as.." dialog, have negative impact on render speed, when used as normal maps too. It's not so huge as in case of opacity maps, but quite significant. Diffuse maps seems is not affected by that plague.

Definitely there's something fishy going on between photoshop and 3ds max. Don't know how you guys, but from now i'll try to stay away from pngs as much as possible :/ Tiff is much safer option, i think.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2014-06-23, 00:39:04
Reply #26

rafpug

  • Active Users
  • **
  • Posts: 723
    • View Profile
Bravo Romulus

This test and "interesting"

Regard
Raf

2014-06-23, 22:01:34
Reply #27

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 6581
  • Let's move this topic, shall we?
    • View Profile
    • My Models
Looks like Rawalanche was right, it is alpha channel. Still, i don't know why 3ds max treats files, that don't have transparency info in it, like that.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2014-06-23, 22:04:39
Reply #28

Ludvik Koutny

  • VIP
  • Active Users
  • ***
  • Posts: 2562
  • Just another user
    • View Profile
    • My Portfolio
Hard to tell... 3ds Max does a lot of things in a weird fashion.

It would be interesting to test all the different file formats in 8bit depth and without alpha channel. Just to be sure there's no performance gain or loss aside from additional channels or extended bit depth :)

Maybe even test formats which can store just monochromatic data (gifs for example).

2014-06-24, 09:43:10
Reply #29

Tanakov

  • Active Users
  • **
  • Posts: 797
  • Corona is faster than diarrhea
    • View Profile
    • https://www.behance.net/Gringott
Thanks this helps a lot, I will now focus on making JPEG's instead of PNG's
Corona since 2014.06.02
https://www.behance.net/Gringott

2014-06-25, 11:14:33
Reply #30

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 6581
  • Let's move this topic, shall we?
    • View Profile
    • My Models
Ok, here's my latest findings.

What's influencing render time:

bit depth - has no impact
image compression - has no impact
additional layers and layer compression - has no impact
channels - does big impact:
  RGB - normal render time
  RGBA - time penalty
  grayscale, indexed colours - huge bonus

All tests was done in Corona, with tiff file format in opacity map. I may do further tests with MR and/or scanline later.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2014-06-25, 11:19:26
Reply #31

Ludvik Koutny

  • VIP
  • Active Users
  • ***
  • Posts: 2562
  • Just another user
    • View Profile
    • My Portfolio
I am actually curious if this is just behavior of TIF, or other file formats as well :) Max does not use one universal plugin to handle image formats. Instead, it has different plugins for different formats of varying quality.

So i would first make sure if this is general behavior, or only TIF format related behavior :)

2014-06-25, 11:45:32
Reply #32

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 6581
  • Let's move this topic, shall we?
    • View Profile
    • My Models
Yes, it's translates to other formats that support alpha channel and/or single channel options.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2014-06-25, 12:13:55
Reply #33

Ondra

  • Administrator
  • Active Users
  • *****
  • Posts: 8913
  • Turning coffee to features since 2009
    • View Profile
ok, I dont have time to investigate this right now, maybe in 2 weeks ;)
Rendering is magic.
Private scene uploader | How to get minidumps for crashed/frozen 3ds Max | Sorry for short replies, brief responses = more time to develop Corona ;)

2014-06-25, 12:52:42
Reply #34

Ludvik Koutny

  • VIP
  • Active Users
  • ***
  • Posts: 2562
  • Just another user
    • View Profile
    • My Portfolio
I see...

Anyway...  thanks a lot for these tests. I know very well that objective testing takes a lot of patience and time. So not many people take their time to systematically test something, but almost everytime someone does, they discover something either very useful, or some severe bug, which when removed, speeds up or improves quality of Corona a lot :)

2014-06-25, 14:10:30
Reply #35

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 6581
  • Let's move this topic, shall we?
    • View Profile
    • My Models
That's interesting, i found that it's related to filtering. If i set texmap filtering to "all" - difference in render time between RGB, RGBA and monochrome, completely disappears.

One additional finding is that standart material's opacity map isn't affected by texmap filtering in Corona settings. I'll report that as a bug.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2014-10-28, 05:56:43
Reply #36

snakebox

  • Active Users
  • **
  • Posts: 493
    • View Profile
    • Snakebox Media
Sorry for reviving this topic, but I haven't seen any changelogs for some of things being fixed?  And I am curious of all this is the same scenario when using .tga files compared to gif/png ?

Thanks guys! interesting find for sure.