Baking doesn't work #33818
Closed
opened 2013-01-10 10:29:37 +01:00 by Enrico Valenza
·
16 comments
No Branch/Tag Specified
main
blender-v4.4-release
remote-asset-library-monolithic
manifold
npr-prototype
blender-v4.2-release
blender-v3.6-release
blender-v4.3-release
temp-sculpt-dyntopo
blender-v3.3-release
brush-assets-project
pr-extensions-tidy-space
blender-v4.0-release
universal-scene-description
blender-v4.1-release
blender-v3.6-temp_wmoss_animrig_public
gpencil-next
blender-projects-basics
sculpt-blender
asset-browser-frontend-split
asset-shelf
blender-v3.5-release
blender-v2.93-release
sculpt-dev
bevelv2
xr-dev
v4.4.1
v4.2.9
v3.6.22
v4.4.0
v4.2.8
v4.2.7
v3.6.21
v4.2.6
v3.6.20
v4.2.5
v3.6.19
v4.3.2
v4.3.1
v4.3.0
v4.2.4
v3.6.18
v4.2.3
v3.6.17
v4.2.2
v3.6.16
v4.2.1
v3.6.15
v4.2.0
v3.6.14
v3.3.21
v3.6.13
v3.3.20
v3.6.12
v3.3.19
v4.1.1
v3.6.11
v3.3.18
v4.1.0
v3.3.17
v3.6.10
v3.6.9
v3.3.16
v3.6.8
v3.6.7
v3.3.14
v4.0.2
v4.0.1
v4.0.0
v3.6.5
v3.3.12
v3.6.4
v3.6.3
v3.3.11
v3.6.2
v3.3.10
v3.6.1
v3.3.9
v3.6.0
v3.3.8
v3.3.7
v2.93.18
v3.5.1
v3.3.6
v2.93.17
v3.5.0
v2.93.16
v3.3.5
v3.3.4
v2.93.15
v2.93.14
v3.3.3
v2.93.13
v2.93.12
v3.4.1
v3.3.2
v3.4.0
v3.3.1
v2.93.11
v3.3.0
v3.2.2
v2.93.10
v3.2.1
v3.2.0
v2.83.20
v2.93.9
v3.1.2
v3.1.1
v3.1.0
v2.83.19
v2.93.8
v3.0.1
v2.93.7
v3.0.0
v2.93.6
v2.93.5
v2.83.18
v2.93.4
v2.93.3
v2.83.17
v2.93.2
v2.93.1
v2.83.16
v2.93.0
v2.83.15
v2.83.14
v2.83.13
v2.92.0
v2.83.12
v2.91.2
v2.83.10
v2.91.0
v2.83.9
v2.83.8
v2.83.7
v2.90.1
v2.83.6.1
v2.83.6
v2.90.0
v2.83.5
v2.83.4
v2.83.3
v2.83.2
v2.83.1
v2.83
v2.82a
v2.82
v2.81a
v2.81
v2.80
v2.80-rc3
v2.80-rc2
v2.80-rc1
v2.79b
v2.79a
v2.79
v2.79-rc2
v2.79-rc1
v2.78c
v2.78b
v2.78a
v2.78
v2.78-rc2
v2.78-rc1
v2.77a
v2.77
v2.77-rc2
v2.77-rc1
v2.76b
v2.76a
v2.76
v2.76-rc3
v2.76-rc2
v2.76-rc1
v2.75a
v2.75
v2.75-rc2
v2.75-rc1
v2.74
v2.74-rc4
v2.74-rc3
v2.74-rc2
v2.74-rc1
v2.73a
v2.73
v2.73-rc1
v2.72b
2.72b
v2.72a
v2.72
v2.72-rc1
v2.71
v2.71-rc2
v2.71-rc1
v2.70a
v2.70
v2.70-rc2
v2.70-rc
v2.69
v2.68a
v2.68
v2.67b
v2.67a
v2.67
v2.66a
v2.66
v2.65a
v2.65
v2.64a
v2.64
v2.63a
v2.63
v2.61
v2.60a
v2.60
v2.59
v2.58a
v2.58
v2.57b
v2.57a
v2.57
v2.56a
v2.56
v2.55
v2.54
v2.53
v2.52
v2.51
v2.50
v2.49b
v2.49a
v2.49
v2.48a
v2.48
v2.47
v2.46
v2.45
v2.44
v2.43
v2.42a
v2.42
v2.41
v2.40
v2.37a
v2.37
v2.36
v2.35a
v2.35
v2.34
v2.33a
v2.33
v2.32
v2.31a
v2.31
v2.30
v2.28c
v2.28a
v2.28
v2.27
v2.26
v2.25
Labels
Clear labels
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Asset datablocks, libraries, browser and shelf
Interest
Audio
Interest
Automated Testing
Interest
BlendFile
Interest
Blender Asset Bundle
Interest
Code Documentation
Code comments, Python/RNA API descriptions
Interest
Collada
Interest
Compatibility
Backward and forward compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
FBX
FBX I/O related topics
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline & IO
Interest
Platforms & Builds
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
USD
Interest
UV Editing
Interest
Undo
Interest
User Interface
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Wayland windowing on Unix
Interest
Workbench
Interest
glTF
glTF format I/O topics
Interest: X11
Xorg/X11 windowing
Legacy
Asset Browser Project
Archived
Legacy
Blender 2.8 Project
Archived
Legacy
Milestone 1: Basic, Local Asset Browser
Archived
Legacy
OpenGL Error
Archived
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Related to security, see policy: https://developer.blender.org/docs/handbook/bug_reports/vulnerability_reports/
Module
Animation & Rigging
Module
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms & Builds
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
Windows
Platform
macOS
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Archived
Type
Report
Archived
Type
To Do
Milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
Hoshinova
James-McCarthy-4
Sebastian-Herholz
casey-bianco-davis
gandalf3
Blendify Aaron Carlisle
quantimoney Aditya Y Jeppu
Alaska Alaska
angavrilov Alexander Gavrilov
frogstomp Aleš Jelovčan
amelief Amélie Fondevilla
elubie Andrea Weikert
Andy_Goralczyk Andy Goralczyk
ankitm Ankit Meel
Anthony-Roberts Anthony Roberts
antoniov Antonio Vazquez
aras_p Aras Pranckevicius
Arnd Arnd Marijnissen
bartvdbraak Bart van der Braak
mont29 Bastien Montagne
blender-bot Blender Bot
bnagirniak Bogdan Nagirniak
BClark Brad Clark
brecht Brecht Van Lommel
BrianSavery Brian Savery (AMD)
ideasman42 Campbell Barton
CharlesWardlaw Charles Wardlaw
CharlieJolly Charlie Jolly
Chris_Blackbourn Chris Blackbourn
lateasusual Chris Clyne (Lateasusual)
ChrisLend Christoph Lendenfeld
HobbesOS Cian Jinks
fclem Clément Foucault
cmbasnett Colin Basnett
Kdaf Colin Marmond
dfelinto Dalai Felinto
pioverfour Damien Picard
DanielBystedt Daniel Bystedt
pepe-school-land Daniel Martinez Lara
zanqdo Daniel Salazar
Mets Demeter Dzadik
erik85 Erik Abrahamsson
EAW Evan Wilson
filedescriptor Falk David
fsiddi Francesco Siddi
GaiaClary Gaia Clary
DagerD Georgiy Markelov
mano-wii Germano Cavalcante
zazizizou Habib Gahbiche
HooglyBoogly Hans Goudey
Harley Harley Acheson
weasel Henrik D.
Hjalti Hjalti Hjálmarsson
howardt Howard Trickey
nirved-1 Hristo Gueorguiev
mod_moder Iliya Katushenock
brita Inês Almeida
JacquesLucke Jacques Lucke
Jason-Fielder Jason Fielder
JasonSchleifer Jason schleifer
Jebbly Jeffrey Liu
Jeroen-Bakker Jeroen Bakker
deadpin Jesse Yurkovich
neXyon Joerg Mueller
eliphaz John Kiril Swenson
guitargeek Johnny Matthews
Brainzman Jonas Holzman
JoniMercado Jonatan Mercado
JorgeBernalMartinez Jorge Bernal
JosephEagar Joseph Eagar
JoshuaLeung Joshua Leung
Bone-Studio Juan Gea
jpbouza-4 Juan Pablo Bouza
JulianEisel Julian Eisel
JulienDuroure Julien Duroure
JulienKaspar Julien Kaspar
kevindietrich Kévin Dietrich
lone_noel Leon Schittek
LucianoMunoz Luciano Muñoz Sessarego
LukasStockner Lukas Stockner
LukasTonne Lukas Tönne
LunaRood Luna Rood
MaiLavelle Mai Lavelle
EosFoxx Marion Stalke
Baardaap Martijn Versteegh
scorpion81 Martin Felke
mendio Matias Mendiola
Matt-McLin Matt McLin
MetinSeven Metin Seven
wave Michael B Johnson
Michael-Jones Michael Jones (Apple)
makowalski Michael Kowalski
pragma37 Miguel Pozo
nrupsis Nate Rupsis
jesterking Nathan Letwory
nathanvegdahl Nathan Vegdahl
PrototypeNM1 Nicholas Rishel
nickberckley Nika Kutsniashvili
Sirgienko Nikita Sirgienko
OmarEmaraDev Omar Emara
pablovazquez Pablo Vazquez
PaoloAcampora Paolo Acampora
PascalSchon Pascal Schön
pmoursnv Patrick Mours
muxed-reality Peter Kim
lichtwerk Philipp Oeser
P2design Pierrick PICAUT
PratikPB2123 Pratik Borhade
Limarest Ramil Roosileht
farsthary Raul Fernandez Hernandez
LazyDodo Ray molenkamp
iss Richard Antalik
rjg Robert Guetzkow
salipour Sahar A. Kashi
Sayak-Biswas Sayak Biswas
Sean-Kim Sean Kim
sherholz Sebastian Herholz
sebastian_k Sebastian Koenig
ZedDB Sebastian Parborg
sebbas Sebastián Barschkis
Sergey Sergey Sharybin
IRIEShinsuke Shinsuke Irie
sidd017 Siddhartha Jejurkar
SietseB Sietse Brouwer
SimonThommes Simon Thommes
SonnyCampbell_Unity Sonny Campbell
Stefan_Werner Stefan Werner
Lockal Sv. Lockal
dr.sybren Sybren A. Stüvel
ThomasDinges Thomas Dinges
Ton Ton Roosendaal
BassamKurdali Ursula kurdali
Vasyl-Pidhirskyi Vasyl Pidhirskyi
WannesMalfait Wannes Malfait
wbmoss_dev Wayde Moss
weizhen Weizhen Huang
leesonw William Leeson
xavierh Xavier Hallade
jenkm Yevgeny Makarov
ChengduLittleA YimingWu
gfxcoder jon denning
Clear assignees
No Assignees
Sergey Sharybin
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#33818
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
%%%--- Operating System, Graphics card ---
Ubuntu 10.10 64 bit - Geforce GT 320M
r53674 but also older, since years starting with the 2.5 series; worked fine in 2.4 series.
I attached a short timelapse recorded trying to bake displacement (and also Full render, that didn't work well neither) to show what I'm trying to say since a couple of years; I had also a displacement baking debugging section with Sergey some time ago, but in the end the bug still shows: in short, trying to bake I obtain randomly wasted, gray, white or black images but not the correct baking.
Open the attached file and press the "bake" button. I attached the timelapse because several time I've been told that "everything works ok here", so maybe it's something related to my system only, dunno (actually seems I'm the only one having these problems with baking).
%%%
Changed status to: 'Open'
%%%Starting from your example file: 8 bit target, distance set, normal in opposite direction.
The value range of the image is "-distance" to "distance" (mapped to 0 to 1). The distance matches the distance to one of the cubes. Floating point errors produce the dots. Normalization won't work, as long the distance is set (should be that way). But pixels further away then -distance (in negative direction) should be black.
This is indeed a bug!
If you set distance to 0, then the mapping is 0 to 1 (also for the image 0 to 1). That means: As long the normal is pointing away you will get only black, because negative values are clamped to 0 and anything is below 0. If the normal points downward, then you will get results, but the maximum distance (distance set to 0) will be 1, which is not enough to reach to the bottom plane. Activating "Normalized" will have no effect since some rays miss the bottom target (scale it a bit larger to avoid this), and will give infinity results.
Conclusion: If distance is set the values of the image (0 to 1) will be mapped from "-distance" to "distance". If -distance is exceeded the result will be white, but should be black. This is a bug. If distance is not set then the range is from 0 to 1 for both. Since negative values can't be stored in an 8 bit image it will be clipped. Normalization only works if all rays hit the target.%%%
%%%PS: They should be black, since the ray hit something in negative direction, even so it was out of range for baking. Otherwise the baker can't decide if to use white or black.%%%
%%%Random dots are indeed caused by floating point precision. One of possible solution would be to add FLT_EPSILON to maximal distance. It'll solve issue in such obvious case but could still behave wrong in other cases.
I didn't understand Tobias's description. If ray doesn't hit anything, displacement is assumed to be zero, which would be mapped to 0.5 anyway.
So, if you'll increase max distance a bit, so there'll be no float point issues and bake to a float buffer, most of the area will have values of 0.5, which equals to no displacement at all. Values in dark area corresponding to bigger cube, will be -0.5 which equals to displacement of -1 (plane normal is looking in positive Z direction), values in black area corresponding to smaller cube will be -0.7, which equals to displacement of -1.2 which also seems to be matching your scene.
If you'll enable normalization, smaller cube will be the most black (as it corresponds to the most displacement by absolute value), bigger cube will be dark gray (a bit smaller displacement than caused by smaller cube). All the rest area will be half-gray (value of 0.5) since there's no displacement at all for that areas.
Enrico, when you're talking something doesn't work, please mention what's the expected for you behavior. Currently i can not see any bigger issues than floating point precision, which is not so trivial to solve.%%%
%%%@Sergey: I mean rays that hit something but are out of range if you set the distance (d). Lets say you set d=1 and your object is 2 BE away in negative direction. Then a ray will hit the object (d=-2) and the result will be clamped (d=-1). The actual color value for -1 is black. But currently it gives gray, which is gives artifacts. I appended an example file in which i would expect to have half of the ramp in gray tones and anything else black. What i get is the ramp (gray to black and black to clamped black). But on the other side, the plane is gray.%%%
%%%Distance isn't used to clamp actual distance between current point and intersection, it defines how far away intersection is allowed to be. So if there is an intersection, but it's ore far away than distance, it wouldn't be detected and will make mesh have no displacement for correspondent point.
Clamping could be useful in some cases as well, but that's not how baker is designed to work and wouldn't consider this is a bug.%%%
%%%But it also does clamp the values already for faces that are partially in range. This is very useful and often necessary for low color resolution bump maps, since it allows to set an absolute scaled distance for the bake. Without that the user looses the ability to define a range mapping without switching to float and processing the image manually and then to convert it back to 8 bit. That is a much more complicated approach. I also see no true benefit in the case that the default value (0.5) is used for all faces further away then the distance. If the intersection is further away, clamping the distance does not hurt and has practical use cases. But just setting a default value has no benefit at all.%%%
%%%"Enrico, when you're talking something doesn't work, please mention what's the expected for you behavior. Currently i can not see any bigger issues than floating point precision, which is not so trivial to solve."
Sergey, the behaviour I expected was just to obtain a grey-scale displacement image map, what else?
Ok, let me explain what I did: I was looking at a video tutorial by Oliver Villar (this one: http://www.youtube.com/watch?v=VY9vHdwUo98), in this tutorial the author had just modelled a quick greeble, added a plane, unwrapped, assigned a blank image map and baked the displacement. In the video it worked perfectly at first try.
I did the same steps, but I just obtained (as you can see in the timelapse I attached) first a black image, then (by trying different settings of the distance value) a gray image, then different incorrect images and so; at the end I managed to obtain a quite good one by setting the distance value to 2.300 and the bias value to 0.100, any other value gives incorrect results. Now, why can't I obtain a simple result at first try as in the video tutorial?
%%%
%%%You do obtain grey-scale displacement, which is computed in exact the same way as baker was designed to work.
Oliver was just lucky enough that defautl parameters worked fine for him in terms they gave okish-look displacement map, But that's just because his scene was small enough and his displacements were smaller than 0.5 blender units, which fitted into visible color range in the image. Your scene is much bigger and displacement doesn't fit visible color range, so you need to do some manual tweaks to make things working.
In fact, you do have correct results in any case, your tricks just mapped displacement to visible space. And actually, that's not necesserily needed if you'll bake to float image -- it should be applied nicely in this case too.
But there's indeed one bad thing here -- normalization for displacement maps maps Distance (which you set in the UI) from range -Distance .. Distance to 0..1, but it'll do nothing if distance equals to zero. That's actually matter of some assumptions, but perhaps normalizing actual values of displacements to 0..1 will sense here.
P.S. You could obtain the same exact results as in tutorial you mentioned by scaling scene down. Nothing actually changed in this area since 2.64.%%%
%%%Actually, i'll check with Brecht if it's indeed makes sense to change behavior of Normalize option.%%%
%%%Ok I see; btw I think it's a bit weird to have a displacement baking feature that works at first try only if you are lucky enough to model everything inside the color range...
And, just a last thing: by setting the distance value to 2.300 and the bias value to 0.100 I managed to obtain a displacement map, but I'm not sure it's a correct one. I'm referring to the contrast of the image: setting the displacement to a strength value of 1.000 doesn't give me back the same displacement, a strength of 4.000 does (so the baked image seems to have lighter contrasts).
Thanks for your time.%%%
%%%It's not weird, it's what displacement map is. It's just values, not colors and if values are not in visible range it's not a bug at all (at least for float images). Baking will happen even if your scene is 30K large, just to see results you couldn't use display but need to either investigate values with mouse or normalize the map manually in compositor.
Setting maximal distance and enabling normalization will map actual displacement values to visible color range, but after this you'll need to alter strength of displacement when you'll use this texture.
I assume this is exact what you did -- baked with distance=2.3, bias=0.1 and normalization enabled. In this case you'll indeed need to increase strength. If you'll do the same bake, but disable normalization and bake to float image, displacement shall be the same with strength=1.%%%
%%%@Enrico: You should also ensure that the image/texture is displayed as "raw data". Otherwise you will have an optical distortion due to color management in the UV/Image editor. If it is displayed as "linear" (the default), then a value of 0.5 will be displayed as the RGB color (0.7, 0.7, 0.7) or something similar. To see the true value you need to check the image by pressing the mouse button. It shows the true (not color managed) value that is stored and used later on for displacement.%%%
%%%@Tobias: yes, but I judged the baked image mainly by the effect it has on the displacement, not from what I see in the UV Editor. :)
@Sergey: I just tried to bake with distance=2.3, bias=0.1 and normalization disabled (and I always baked to an OpenEXR 32 bit image) and I obtained an almost totally black image; but just to be sure I assigned it to the displacement of a subdivided plane and there was no effect at all.%%%
%%%I've implement normalization of displacement map in cases maximal distance is set to 0 in svn rev53947.
I could see why displacement map doesn't work for you if you bake without normalization/flipping normal -- for some reason texture sampler will clamp negative values to zero, which eliminates displacement. Removing this clamp will make displacement applied correctly without additional settings in your particular case but it'll break lots of files. So either normalize displacement and set displacement strength afterwards or flip normal of object you're baking on first.
Could not see what else could be done here to make displacement baker working more expectable here, it's just not thing which you could press couple of buttons and have correct result. I'll try to find time next couple of days writing fuller explanation how it works in the wiki.
Thanks for the report, but considering it solved for now.%%%
Changed status from 'Open' to: 'Resolved'