Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1366136 Posts in 64012 Topics- by 55898 Members - Latest Member: obemef

September 17, 2019, 09:09:00 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)General thread for quick questions
Pages: 1 ... 65 66 [67]
Print
Author Topic: General thread for quick questions  (Read 59327 times)
Crimsontide
Level 5
*****


View Profile
« Reply #1320 on: April 08, 2019, 09:57:44 AM »

I don't understand then... what is depth going to get you?  Just knowing how far an infinitely thin single ray would penetrate wouldn't give you anything that of use.  I don't understand how that would make convincing hair.

What your describing (if I understand it correctly) sounds like Volumetric Appearance Modelling.  Here's some articles that might help: http://www.cs.cornell.edu/projects/ctcloth/
Logged
gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #1321 on: April 08, 2019, 10:03:27 AM »

No that's not it at all, it's closer to a simple parallax mapping, that's it. It's not realistic micro scale either.

Another to see it is that it's like interior mapping tricks.
« Last Edit: April 08, 2019, 10:12:51 AM by gimymblert » Logged

gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #1322 on: April 08, 2019, 10:22:25 AM »

It's close to that:
https://computergraphics.stackexchange.com/questions/4094/is-there-a-method-to-do-ray-marching-style-modulus-repeat-with-raytracing
https://www.shadertoy.com/view/lly3Rc
https://www.shadertoy.com/view/MlK3zt
Logged

BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #1323 on: April 08, 2019, 10:58:17 AM »

Quote
1. hair are approximate as parallels, you can then turn that into a 2d problem by taking the cross section.
2. the 2d problem can be turned into a 1d problem, using slopes to compute a delta. So it become an interval overlap problem.
3. The line is wrapping, basically a circle topologically, so it's equivalent to the overlap of the clock needles or planet alignment (that is when big needle move a certain distance (in our case the wrapping unit) the small needle advance at another rate, given the two rate, when will they overlap, here when will have a hit, with in this case discrete movement instead of continuous like clocks and planets).
I understand (1) and (2). What I'm telling you is (3) isn't helpful. You must write a loop either way, and none of the maths is simpler. The stack overflow post tells you the same thing.

Quote
It's analytical so there is no recursion (ie no stepping through the volume, it's basically a single primitive intersection that have visual recurrence property due to wrapping).
To re-iterate, I see no way of doing this without a loop.

Quote
Ok, I had a look, at this, its very nice. I think it explains very well what you are after. At first glance, this demo contradicts what I wrote above as it has no loops in it. But no. It only works when the mask is very fat. Anthing narrower than 50% of the repeat width runs into problems. You can see that with your second link, with the "thin square". It has graphical glitches which none of the other masks have. So for hair like thicknesses, it's not going to work.
Logged
gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #1324 on: April 08, 2019, 11:38:53 AM »

Quote
    The idea is that you can reduce the problem from 3d to 2d by seeing where the ray hits the first two planes
    and then using the uv coordinates of those intersections as two points defining a 2d ray.  You then do a
    2d raytrace of that ray versus a shape, but valid intersection distances are a multiple of the vector's length
    instead of a continuous calculation.

    For this to work, you need to be able to analystically solve 2d ray vs 2d infinitely repeating shape.

    An way to solve this is to make sure the shape is constrained to a single tile, and when laying the shape on
    a grid, that no border between "open spaces" is less than 0.5 units.

    The reason for that is because the vector can at most move by 0.5 units on any single axis (since we modulus the vector).
   
    If we have a border that is less than 0.5, we will think we got a hit, when in fact it might be a miss, if the sample point
    is not actually inside the solid point!

    The last two shapes are fail cases.

    The checkerboard is a problem because if the ray is moving up and to the right or down and to the left, it can encounter
    border thickness less than 0.5.

    The thin square is a problem because it has a very thin border, which is less than 0.5 in all directions!

    The ultimate goal of this stuff is to try and figure out how to make infinitely repeating shapes in ray tracing, like
    can be done in ray marching via modulus!
    http://computergraphics.stackexchange.com/questions/4094/is-there-a-method-to-do-ray-marching-style-modulus-repeat-with-raytracing

I think it's a bit different, he solve the problem empirically and didn't pursue further (all contribution by him on internet stop by that point) he basically said it wanted to go further than the limitation here. Also he work on a 2d approximation, I further reduce it to 1d. And we can "see" in the 1d problem that it's a periodic or "rate" problem, except I don't have the mathematical competence to translate it, but I can trace it empirically.

I'm not sure the reason that doesn't work has anything to do with the fundamental, for example I don't use the modulo, I avoid modulo by translating into periodicity (hence focusing on wrapping) that's the contribution I'm trying to make.

I think getting stuck on the raytracing/raymarching semantic it emulate is a red herring. That's why I didn't focus so much on the aspects of the idea, but more on the "math". Once you unfold the space, it looks very much like a trig problem, except we don't intercept a continuous line.

Think about it, if you have two interger interval, you can deduce the bigger pattern by simply multiplying them, so if you have a beat on twos and a beat on 3, they pulse the same way on 6 because (2*3=6) so you have a new interval from the former two. Now if you have 2 beat on twos, they are sync, but if you offset one by one unit, they will never be sync ever. By going 1d I basically have the same problem. I need to translate that intuition into proper mathematical terms and formula.
Logged

Crimsontide
Level 5
*****


View Profile
« Reply #1325 on: April 08, 2019, 11:47:45 AM »


That is kinda what I pictured you were trying to do.  The thing I don't understand is how that will translate to anything resembling hair.

I think you're also getting a bit confused, or at least I am by your explanation.  The modulo (or similar like bitwise AND on a fixed point/integer) is required to avoid having to repeatedly step through the intervals.
Logged
gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #1326 on: April 08, 2019, 11:56:27 AM »

Forget hair then lol

I don't need modulo precisely because I don't want to STEP through the interval, we already have the interval (the rates) all my explanation is basically trying to demonstrate it's a problem ANALOGUE to rate superposition or any similar problem (ie intersection between two moving elements, like in dead reckoning) all can be solved analytically without stepping through.
Logged

qMopey
Level 5
*****


View Profile WWW
« Reply #1327 on: April 08, 2019, 12:14:49 PM »

demonstrate it's a problem ANALOGUE to rate superposition or any similar problem (ie intersection between two moving elements, like in dead reckoning) all can be solved analytically without stepping through.

Unless the shapes are rotating. Then you have an arbitrary non-linear equation, which cannot be solved analytically as there is no geometric pattern of the function to follow.
Logged
gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #1328 on: April 08, 2019, 12:21:08 PM »

Let's forget about all of that:

Let's say you have two beats with different frequency, is there a formula that tells you when the beat will happen at the same time and or if they will never. With t=0 the start of the primary beat and offset the start of the secondary beat (that happen before the first beat get it's second pulse).

This is the problem I'm really trying to solve.
Logged

BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #1329 on: April 10, 2019, 12:15:06 PM »

Quote
Let's say you have two beats with different frequency, is there a formula that tells you when the beat will happen at the same time and or if they will never. With t=0 the start of the primary beat and offset the start of the secondary beat (that happen before the first beat get it's second pulse).

This is the problem I'm really trying to solve.

Ok, firstly, that'a actually a simpler question than you were asking before (before, the "beats" had a width they could overlap at, now they are instantaneous. I think you'd find the instantaneous variant is actually not useful to you).

And secondly, that question *still* cannot be solved in constant time. It's actually a variant of a "linear diophantine equation", which requires you to compute the GCD of the periods.
Logged
gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #1330 on: April 10, 2019, 02:32:11 PM »

Are you sure? I don't have many unknown at all! ALso I don't understand the GCD as I don't need to stay on integer, I use beat as a way to illustrate the problem because people where getting stuck.

Since then I found teh planet alignment problem that solve this in a simple equation:
https://www.mathpages.com/home/kmath161/kmath161.htm
In fact I was having problem because I was trying to either divide or multiply, apparently we need to multiply the inverse of the rate, it also similar the common trivial problem of two vehicle traveling at different speed and ask when one will overtake the other, that is you need the ratio of one speed to the other. Also in my case I have a lot or normalisation that simplify the problem.

But maybe I made a mistake I still can't see? I haven't implemented it yet, I'm ready to see my delusion collapse on my feet (or I'll forget a single ";" or swap two variable and cry all my day out until someone point to me I missed something obvious) ... Huh? This is hard.

Also I contacted the person who made the shadertoy, and he @ the person who made the original implementation who inspired him (also made the clay sdf game on ps4) and he told me that we can trace cylinder in O(1) using such technique. https://twitter.com/SebAaltonen/status/1115486353649741824

I think in general my questions are confusing because I take a concrete problem, expose it and go through layer of abstraction to reveal the real problem I'm having, then ask about how to solve the abstraction, to which people are lost because between the start and the end there is no easy relation. I mean I got to hair to beat synchrony in 2s :O I'm not good with translating those translation into math either.

I'm currently really reassessing how I ask for help and how to present stuff Huh? I'm not good at it lol.
Logged

qMopey
Level 5
*****


View Profile WWW
« Reply #1331 on: April 10, 2019, 02:53:57 PM »

I can say I’ve always wanted to help you with your projects but have never really understood what you’re talking about  Shrug
Logged
gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #1332 on: April 10, 2019, 04:07:33 PM »

Nah I understood, probably that if I was able to clearly pose the problem I would be able to solve it myself lol, so I think that engaging with you actually help make thing clear by removing the clutter, as I'm forced to distill down the problem in a way that's understandable.

Anyway I took inspiration of the planet thing, which I can see with a renewed light, if it's correct we have this:
let say we have two point moving at two rate,
- the position of each point = rate * t.
- Therefore position1 = position2 it mean that rate1 * t = rate2 * t,
- that is (rate1-rate2) * t .
What's missing is the bigger period in which rate1 and rate2 are inscribed,
- we can get it by having rate1 * rate2.
- So rate1 and rate2 are sync for t= k(rate1*rate2) / (rate1 -rate2) with k being the number of period.

However we have a specific case where rate2 = the normalized wraping size, rate2 = 1, for k = 1 we have t = rate1 / (rate1-1).

But we only assume no rate as an offset,
- so if we check with offset we have position1+ offset = position2,
- which translate (rate1 *t) +offset = rate2 *t
- which lead to t * (rate1 - rate2) + offset
and we can probably write the final result as t = k(rate1*rate2) / (rate1-rate2+offset)
which finalized as
t = k(rate1) / (rate1+offset-1) which has no solution when rate1+offset = 1

Probably? Any mistake?


WHat bother me is when rate1 < 1
Logged

Pages: 1 ... 65 66 [67]
Print
Jump to:  

Theme orange-lt created by panic