Procedural hatching in solid viewport shading - is possible?

Is possible to reach Procedural hatching in solid view-port shading? I need this due requirements for result with background view-port colur as white.

hatching.blend (109.1 KB)

You’re close- just add another wave texture going the other way :wink:

Connect to UV, apply one more wave, and rotate 90 degrees

Thx for attention, but I’m asking about solid. Look image, on left part.
I’m looking some simplification for technical drawnings without render maybe. on pure white background. In case render we need operate light, this giving some shadows, etc. and I need simple sketch.

The best if I can reach this on Flat, Attribute and view-port white.

Just need hatching here on left in this mode : )

as far as I know procedural materials won’t show up in solid mode. Only image textures

1 Like

For example I adding a background white.png to camera and also not reaching right result. Don’t know it’s bug or doing something wrong here. In case I made many videos with background animation as video.

Ok… I add… background white not in camera but to world, now have white background but object hatching not satisfying me as normal sketch, due more gray than black and white.

so give it more contrast maybe? Make the lines wider, play with color management exposure/gamma etc…
hatching2.blend (112.5 KB)

1 Like

Right… better, but… the lines are not ideal… looks more like waved or something on opposite walls of cube.

Also thinkinig how to reach lines on edge only. Adding wirefreame without replacing is not soo smart here. Any idea?

Ok, I have idea how to fix lines, but these are depend due focal length I think. By this I need link in some way a camera focal length to the wave scale…
Still no idea what about edges…

hatching-thorn.blend (130.5 KB)

2 Likes

@thorn yeah, this can simplify the way, but the right scale is related with Location x,y,z of camera… and transformation. Right? Then not so easy : )
What a challenge. I did not expect so many complications with this.

So you want the scale to be locked to the object/camera distance, and change based on camera distance?

Try adding a camera target (or just a null, placed in the scene), then add a driver to the Wave value input (scale) based on distance from camera to null.Or you could just unwrap the cube, and apply the texture with UV coordinates.

I think what you’re hoping for is a paradox - you can’t have lines that don’t change scale regardless of the camera angle/position, but also change scale based on the camera angle/position.

You’re going to have to pick one that’s a constant as your favorite, and creatively work to solve the other.

2 Likes

view aligned hatch.blend (126.4 KB)


Like this?

1 Like

@baoyu this is pretty nice! Thank You! Analyzing. What if we can just on side line but on each wall in different side and opposite to each otter?
Good trick with edge.

Ok solved one wall, but top is not what can be expected.

@thorn I will try some experiments by Your suggestions around camera.

That is correct, coz when distance is changed, then lines are often not visible or whole object diapering.

I have mine controlled by a Point Light by pulling the texture coordinates from the light…and it follows the curvature of the mesh…It will fail, for instance, if the light is behind the object there will be a light bleed as the mesh has no thickness, just like light bleed inside a box… but with a strong point light ( 4000w) it can be minimized…

Here is the Node-Group…for the crossed hatch I just duplicate this and mix…

Here is the mix…

1 Like

But did You solved the case of camera distance?
@thorn I did not found right factor for distance driver that can be constant.
https://recordit.co/6SCJCQGOsu
As You understanding we have eg. constat var like 25 where lines are ok for camera, and any changes of distance must leave or set this value. It’s more for python script case to create this type factor to copy into driver as property value. I never to this type case as geting data to driver from python calc/math.

I’m trying to understand, but I don’t know what you want… You seem to keep changing the goal. Maybe it would help if you fake it with two images and Photoshop or something like that, and show a near and far example of the result you want.

(In the quote above, you have literally given two different, opposite goals that you want simultaneously…)

1 Like