ShaderLab: correctly using Offset, Factor and Units?

In the documentation of ShaderLab culling and depth testing you have the following:


Offset Factor, Units

Allows you specify a depth offset with two parameters. factor and units. Factor scales the maximum Z slope, with respect to X or Y of the polygon, and units scale the minimum resolvable depth buffer value. This allows you to force one polygon to be drawn on top of another although they are actually in the same position. For example Offset 0, -1 pulls the polygon closer to the camera ignoring the polygon’s slope, whereas Offset -1, -1 will pull the polygon even closer when looking at a grazing angle.

I have the following scenery, it’s two cylinders of the same size, one being the sky, one being the horizon on the floor, it is shown exactly how it is expected to render:

enter image description here

This is how it actually looks without playing with the offset factor and units, lots of Z-fighting:

enter image description here

I had to put a fairly high value to Factor so Z-fighting stops, around 15.

And setting the value of Units has absolutely no effect.

So I’m a bit at a loss as on how to correctly use both of these parameters.


Can you explain how shall one understand the meaning and correctly use Factor and Units?

ReplaceAll doesn’t replace all, factor out negative sign first

I have this matrix:$ $ \left( \begin{array}{ccccc} \{\{0\},\{0,0,0\}\} & \{\{1\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} \ \{\{-1\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} \ \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,z,-y\}\} & \{\{0\},\{-z,0,x\}\} \ \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,-z,y\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{y,-x,0\}\} \ \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{z,0,-x\}\} & \{\{0\},\{-y,x,0\}\} & \{\{0\},\{0,0,0\}\} \ \end{array} \right)$ $

When I run ReplaceAll (/.) on it using this$ $ \left\{\{\{1\},\{0,0,0\}\}\to X_1,\left\{\{t\},\left\{\frac{2 x}{3},\frac{2 y}{3},\frac{2 z}{3}\right\}\right\}\to X_2,\{\{0\},\{y,-x,0\}\}\to X_3,\{\{0\},\{z,0,-x\}\}\to X_4,\{\{0\},\{0,z,-y\}\}\to X_5,\{\{0\},\{0,0,0\}\}\to 0\right\}$ $

it doesn’t replace everything:

$ $ \left( \begin{array}{ccccc} 0 & X_1 & 0 & 0 & 0 \ \{\{-1\},\{0,0,0\}\} & 0 & 0 & 0 & 0 \ 0 & 0 & 0 & X_5 & \{\{0\},\{-z,0,x\}\} \ 0 & 0 & \{\{0\},\{0,-z,y\}\} & 0 & X_3 \ 0 & 0 & X_4 & \{\{0\},\{-y,x,0\}\} & 0 \ \end{array} \right)$ $

I expect:$ $ \left( \begin{array}{ccccc} 0 & X_1 & 0 & 0 & 0 \ -X_1 & 0 & 0 & 0 & 0 \ 0 & 0 & 0 & X_5 & -X_4 \ 0 & 0 & -X_5 & 0 & X_3 \ 0 & 0 & X_4 & -X_3 & 0 \ \end{array} \right)$ $

Is there an automated way of doing these replacements?

Does Two Factor Authentication (2FA) prevent Phishing and/or Man-in-the-Middle (MITM) attacks?

While 2FA is clearly an improvement over only a single factor, is there anything which prevents an adversary presenting a convincing sign-in page which captures both factors?

I realise that technically a MITM attack is different to a Phishing attack, though at a high level they’re very similar — the user is inputting their credentials into an attacker-controlled page and the attacker can then input the credentials onwards into the real page.

How do I share secret key files with Docker containers following 12 Factor App?

I am building an API and trying to follow the 12 Factor App methodology. Using Docker, the methodology says containers must be disposable.

Assuming the API will have high traffic, multiple docker containers will be running with the same app, connecting to the same database.

Certain fields in the database are encrypted and stored with a reference to the file containing the passphrase. – This is done so the passphrase can be updated, and old data can still be decrypted.

With a Docker container and following 12 Factor App, how should I provide the key files to each of the containers?

Am I correct in assuming I would need a separate server to handle the creating of new key files and distributing them over the network?

Is there secure software, protocols or services that do this already, or would I need a custom solution?

Community detections in networks using more than one factor?

all community detection algorithms in major python packages are using only edges & edge weights. Is there any algorithm that uses multiple attributes of nodes to detect communities?

For ex, in social network, while edges imply relationships, nodes have attributes like age, gender, & interest. Given that FB does have predictions and suggestions, I suspect there are algorithms that use multiple factors to find communities.

Do any single-cell organisms exist that approximate NP-hard problems within a factor better than $1/2$ $log$2?

I’ve seen on Wikipedia; that set covering cannot be approximated in polynomial time to within a factor mentioned above. Unless $ NP$ has quasipoly-time algorithms.

Now, this must pertain to classical algorithms and does not mention any approximation algorithms that may only work in nature.

(eg. Things like Amoebas solving $ TSP$ problems)

  • Do any single-cell organisms show any promise in solving $ NP$ -hard problems in polynomial-time?

  • Or approximating them better than any known classical algorithms?

What is and amplification factor in pseudo-random generators?

I can’t seem to find an answer to this. For instance, I have this question:

Show that, if $ P=NP$ , there aren’t any pseudo-random generators (even with amplification factor $ n+1$ ).

My gut tells me this is because, in a world where $ P=NP$ , pretty much any process can be efficiently inverted so there aren’t one-way functions (which pseudo-random generators rely on).

mutiply x axis by a factor

i have this equation

 (3.47471*10^31 (3.525 + 3.83003*10^-10 F^2))/(0.5814 +   9.89982*10^-10 F^2 + 1.05946*10^-20 F^4) 

i can plot it simply. however i want to multiply x and y axes by a desired factor, i can do it for y axis, how can i modify the x axis?

Plot[Evaluate[{10^-9 \[Kappa]e}], {F, 0, 2 10^17},  PlotRange -> {Automatic, {0, 10}}, Frame -> True, AspectRatio -> 1,  FrameLabel -> {"B/\[Rho](G.\!\(\*SuperscriptBox[\(cm\), \ \(2\)]\).\!\(\*SuperscriptBox[\(g\), \(-1\)]\))",  "(\!\(\*SubscriptBox[\(\[Kappa]\), \ \(e\)]\))\[Times]\!\(\*SuperscriptBox[\(10\), \ \(9\)]\)(\!\(\*SuperscriptBox[\(cm\), \(-1\)]\).\!\  (\*SuperscriptBox[\ \(s\), \(-1\)]\))"},  FrameStyle -> Directive[Bold, Black, (FontSize -> 15)],  PlotLegends ->  Placed[LineLegend[{Style[   "\!\(\*SubscriptBox[\(\[Kappa]\), \(i\)]\)", "Times", 15,    Bold]}], {0.85, 0.85}],  PlotStyle -> {Blue, Directive[Red, Dashed]}] 

enter image description here