Inversion of Gradient Noise Function
$begingroup$
Brief As Possible
Given any equation $f(x)$ which adheres to a predefined pattern, there is always a way (sometimes not directly calculable) to get $f^{-1}(x)$ (which may be a set) such that $f^{-1}(f(x))$ $ni$ $x$. Let $f(x)$ be a noise equation (or any equation that could be practically used for half-decent terrain generation) of your choice, then let $z$ and $x$ be known constants. How do I get/approximate the nearest $f^{-1}(x)$ to $z$? How do I find the next closest? In a specific direction from $z$? In a range? At the very least the solution must be more efficient than guessing-and-checking.
The Full Question
I have an arbitrary noise algorithm. Which specific noise algorithm I shall use depends on the answer to this question.
Background Info/Backstory
The background is that I am trying to program a dynamically generated infinite world for people whose demanding daily lives require them to escape into a virtual world of fantasy—just like the popular children video game Minecraft. Unlike Minecraft, this fantasy world will be much more complex and interconnected: it will have realistic social transportation dynamics such that every person generated in the game has a nonrandom place to work, place to go home, places for recreation, etc. This integrated system is the opposite of another popular video game, The Sims, where random people are randomly generated and (when you develop relations with said people, they are) given a random home.
The way these virtual people would be generated is as follows. The program would take the coordinates of where the person lives and feed these coordinates into special gradient noise equations that would describe the various aspects and characteristics of the player. Then, the person's place of work would also be factored in (e.x. if the virtual person works at an asbestos factory, then they would be at a higher risk of Mesothelioma later in life). I have yet to figure out how ancestral lineages would be generated on account of immigration and emigration patterns, but I shall likely figure out that doosie when I come to it.
However, I have encountered a major problem with these plans: performance. The problem is that in order to generate these virtual people using conventional programming strategies while still ensuring that people who work a long way from home can still be seen driving to/from work, I would have to render like tens of miles around the user. No common average computer has the memory to handle this massive workload, no matter what programming language is used or how memory optimized the program is, on account of the pigeonhole principle. The only solution I have found thus far is to get/approximate the $f^{-1}(x)$ inverse of a gradient noise equation. This inverse could then be applied to the coordinates of a place of work to find a finite list of possible locations where there might be the virtual house of someone who works at this factory. Albeit, sometimes it would probably be rather large, but it would still be incredibly faster and actually practical compared to rendering for miles around the user playing the game.
However, getting the inverse of a gradient noise equation poses another problem: I don't have the slightest clue how to do it or how it could ever be consistently calculated. Therein is the question: given a certain desired value of $y$, a gradient noise equation of your choice, and a target number $z$, how do I calculate $y=f^{-1}(x)$ to find values of $x$ near to $z$ such that plugging these values of $x$ back into the original $f(x)$ equation yields $y$ (or, at least, yields a number within a specified tolerance of $y$).
Please trust me when I tell you that any objective procedure no matter how far fetched can be implemented in coding. Further, this is a Mathematics forum, not Stackoverflow, so it is entirely my responsibility to worry about the implementation, not your responsibility or duty (although, if you do have general comments that you had in mind for performant implementation, then I don't think it would hurt too much to sneak these comments in at the end of your proposed answer). I cannot stress enough that even if you have a working solution, but you think it will not be programmable or that you will not express it "eloquently" enough, then please just go ahead and post your solution anyway. To me, it doesn't make any difference if all you have is a 3rd grade understanding of basic algebra: so long as your solution in whatever way you present/explain it works, then your solution is a winner and I shall be very happy.
P.S. If you find a much better solution that solves my original problem, and I have been overcomplicating the whole thing, then I would be happy to mark that response as the solution.
inverse approximation inverse-function finitely-generated noise
$endgroup$
add a comment |
$begingroup$
Brief As Possible
Given any equation $f(x)$ which adheres to a predefined pattern, there is always a way (sometimes not directly calculable) to get $f^{-1}(x)$ (which may be a set) such that $f^{-1}(f(x))$ $ni$ $x$. Let $f(x)$ be a noise equation (or any equation that could be practically used for half-decent terrain generation) of your choice, then let $z$ and $x$ be known constants. How do I get/approximate the nearest $f^{-1}(x)$ to $z$? How do I find the next closest? In a specific direction from $z$? In a range? At the very least the solution must be more efficient than guessing-and-checking.
The Full Question
I have an arbitrary noise algorithm. Which specific noise algorithm I shall use depends on the answer to this question.
Background Info/Backstory
The background is that I am trying to program a dynamically generated infinite world for people whose demanding daily lives require them to escape into a virtual world of fantasy—just like the popular children video game Minecraft. Unlike Minecraft, this fantasy world will be much more complex and interconnected: it will have realistic social transportation dynamics such that every person generated in the game has a nonrandom place to work, place to go home, places for recreation, etc. This integrated system is the opposite of another popular video game, The Sims, where random people are randomly generated and (when you develop relations with said people, they are) given a random home.
The way these virtual people would be generated is as follows. The program would take the coordinates of where the person lives and feed these coordinates into special gradient noise equations that would describe the various aspects and characteristics of the player. Then, the person's place of work would also be factored in (e.x. if the virtual person works at an asbestos factory, then they would be at a higher risk of Mesothelioma later in life). I have yet to figure out how ancestral lineages would be generated on account of immigration and emigration patterns, but I shall likely figure out that doosie when I come to it.
However, I have encountered a major problem with these plans: performance. The problem is that in order to generate these virtual people using conventional programming strategies while still ensuring that people who work a long way from home can still be seen driving to/from work, I would have to render like tens of miles around the user. No common average computer has the memory to handle this massive workload, no matter what programming language is used or how memory optimized the program is, on account of the pigeonhole principle. The only solution I have found thus far is to get/approximate the $f^{-1}(x)$ inverse of a gradient noise equation. This inverse could then be applied to the coordinates of a place of work to find a finite list of possible locations where there might be the virtual house of someone who works at this factory. Albeit, sometimes it would probably be rather large, but it would still be incredibly faster and actually practical compared to rendering for miles around the user playing the game.
However, getting the inverse of a gradient noise equation poses another problem: I don't have the slightest clue how to do it or how it could ever be consistently calculated. Therein is the question: given a certain desired value of $y$, a gradient noise equation of your choice, and a target number $z$, how do I calculate $y=f^{-1}(x)$ to find values of $x$ near to $z$ such that plugging these values of $x$ back into the original $f(x)$ equation yields $y$ (or, at least, yields a number within a specified tolerance of $y$).
Please trust me when I tell you that any objective procedure no matter how far fetched can be implemented in coding. Further, this is a Mathematics forum, not Stackoverflow, so it is entirely my responsibility to worry about the implementation, not your responsibility or duty (although, if you do have general comments that you had in mind for performant implementation, then I don't think it would hurt too much to sneak these comments in at the end of your proposed answer). I cannot stress enough that even if you have a working solution, but you think it will not be programmable or that you will not express it "eloquently" enough, then please just go ahead and post your solution anyway. To me, it doesn't make any difference if all you have is a 3rd grade understanding of basic algebra: so long as your solution in whatever way you present/explain it works, then your solution is a winner and I shall be very happy.
P.S. If you find a much better solution that solves my original problem, and I have been overcomplicating the whole thing, then I would be happy to mark that response as the solution.
inverse approximation inverse-function finitely-generated noise
$endgroup$
add a comment |
$begingroup$
Brief As Possible
Given any equation $f(x)$ which adheres to a predefined pattern, there is always a way (sometimes not directly calculable) to get $f^{-1}(x)$ (which may be a set) such that $f^{-1}(f(x))$ $ni$ $x$. Let $f(x)$ be a noise equation (or any equation that could be practically used for half-decent terrain generation) of your choice, then let $z$ and $x$ be known constants. How do I get/approximate the nearest $f^{-1}(x)$ to $z$? How do I find the next closest? In a specific direction from $z$? In a range? At the very least the solution must be more efficient than guessing-and-checking.
The Full Question
I have an arbitrary noise algorithm. Which specific noise algorithm I shall use depends on the answer to this question.
Background Info/Backstory
The background is that I am trying to program a dynamically generated infinite world for people whose demanding daily lives require them to escape into a virtual world of fantasy—just like the popular children video game Minecraft. Unlike Minecraft, this fantasy world will be much more complex and interconnected: it will have realistic social transportation dynamics such that every person generated in the game has a nonrandom place to work, place to go home, places for recreation, etc. This integrated system is the opposite of another popular video game, The Sims, where random people are randomly generated and (when you develop relations with said people, they are) given a random home.
The way these virtual people would be generated is as follows. The program would take the coordinates of where the person lives and feed these coordinates into special gradient noise equations that would describe the various aspects and characteristics of the player. Then, the person's place of work would also be factored in (e.x. if the virtual person works at an asbestos factory, then they would be at a higher risk of Mesothelioma later in life). I have yet to figure out how ancestral lineages would be generated on account of immigration and emigration patterns, but I shall likely figure out that doosie when I come to it.
However, I have encountered a major problem with these plans: performance. The problem is that in order to generate these virtual people using conventional programming strategies while still ensuring that people who work a long way from home can still be seen driving to/from work, I would have to render like tens of miles around the user. No common average computer has the memory to handle this massive workload, no matter what programming language is used or how memory optimized the program is, on account of the pigeonhole principle. The only solution I have found thus far is to get/approximate the $f^{-1}(x)$ inverse of a gradient noise equation. This inverse could then be applied to the coordinates of a place of work to find a finite list of possible locations where there might be the virtual house of someone who works at this factory. Albeit, sometimes it would probably be rather large, but it would still be incredibly faster and actually practical compared to rendering for miles around the user playing the game.
However, getting the inverse of a gradient noise equation poses another problem: I don't have the slightest clue how to do it or how it could ever be consistently calculated. Therein is the question: given a certain desired value of $y$, a gradient noise equation of your choice, and a target number $z$, how do I calculate $y=f^{-1}(x)$ to find values of $x$ near to $z$ such that plugging these values of $x$ back into the original $f(x)$ equation yields $y$ (or, at least, yields a number within a specified tolerance of $y$).
Please trust me when I tell you that any objective procedure no matter how far fetched can be implemented in coding. Further, this is a Mathematics forum, not Stackoverflow, so it is entirely my responsibility to worry about the implementation, not your responsibility or duty (although, if you do have general comments that you had in mind for performant implementation, then I don't think it would hurt too much to sneak these comments in at the end of your proposed answer). I cannot stress enough that even if you have a working solution, but you think it will not be programmable or that you will not express it "eloquently" enough, then please just go ahead and post your solution anyway. To me, it doesn't make any difference if all you have is a 3rd grade understanding of basic algebra: so long as your solution in whatever way you present/explain it works, then your solution is a winner and I shall be very happy.
P.S. If you find a much better solution that solves my original problem, and I have been overcomplicating the whole thing, then I would be happy to mark that response as the solution.
inverse approximation inverse-function finitely-generated noise
$endgroup$
Brief As Possible
Given any equation $f(x)$ which adheres to a predefined pattern, there is always a way (sometimes not directly calculable) to get $f^{-1}(x)$ (which may be a set) such that $f^{-1}(f(x))$ $ni$ $x$. Let $f(x)$ be a noise equation (or any equation that could be practically used for half-decent terrain generation) of your choice, then let $z$ and $x$ be known constants. How do I get/approximate the nearest $f^{-1}(x)$ to $z$? How do I find the next closest? In a specific direction from $z$? In a range? At the very least the solution must be more efficient than guessing-and-checking.
The Full Question
I have an arbitrary noise algorithm. Which specific noise algorithm I shall use depends on the answer to this question.
Background Info/Backstory
The background is that I am trying to program a dynamically generated infinite world for people whose demanding daily lives require them to escape into a virtual world of fantasy—just like the popular children video game Minecraft. Unlike Minecraft, this fantasy world will be much more complex and interconnected: it will have realistic social transportation dynamics such that every person generated in the game has a nonrandom place to work, place to go home, places for recreation, etc. This integrated system is the opposite of another popular video game, The Sims, where random people are randomly generated and (when you develop relations with said people, they are) given a random home.
The way these virtual people would be generated is as follows. The program would take the coordinates of where the person lives and feed these coordinates into special gradient noise equations that would describe the various aspects and characteristics of the player. Then, the person's place of work would also be factored in (e.x. if the virtual person works at an asbestos factory, then they would be at a higher risk of Mesothelioma later in life). I have yet to figure out how ancestral lineages would be generated on account of immigration and emigration patterns, but I shall likely figure out that doosie when I come to it.
However, I have encountered a major problem with these plans: performance. The problem is that in order to generate these virtual people using conventional programming strategies while still ensuring that people who work a long way from home can still be seen driving to/from work, I would have to render like tens of miles around the user. No common average computer has the memory to handle this massive workload, no matter what programming language is used or how memory optimized the program is, on account of the pigeonhole principle. The only solution I have found thus far is to get/approximate the $f^{-1}(x)$ inverse of a gradient noise equation. This inverse could then be applied to the coordinates of a place of work to find a finite list of possible locations where there might be the virtual house of someone who works at this factory. Albeit, sometimes it would probably be rather large, but it would still be incredibly faster and actually practical compared to rendering for miles around the user playing the game.
However, getting the inverse of a gradient noise equation poses another problem: I don't have the slightest clue how to do it or how it could ever be consistently calculated. Therein is the question: given a certain desired value of $y$, a gradient noise equation of your choice, and a target number $z$, how do I calculate $y=f^{-1}(x)$ to find values of $x$ near to $z$ such that plugging these values of $x$ back into the original $f(x)$ equation yields $y$ (or, at least, yields a number within a specified tolerance of $y$).
Please trust me when I tell you that any objective procedure no matter how far fetched can be implemented in coding. Further, this is a Mathematics forum, not Stackoverflow, so it is entirely my responsibility to worry about the implementation, not your responsibility or duty (although, if you do have general comments that you had in mind for performant implementation, then I don't think it would hurt too much to sneak these comments in at the end of your proposed answer). I cannot stress enough that even if you have a working solution, but you think it will not be programmable or that you will not express it "eloquently" enough, then please just go ahead and post your solution anyway. To me, it doesn't make any difference if all you have is a 3rd grade understanding of basic algebra: so long as your solution in whatever way you present/explain it works, then your solution is a winner and I shall be very happy.
P.S. If you find a much better solution that solves my original problem, and I have been overcomplicating the whole thing, then I would be happy to mark that response as the solution.
inverse approximation inverse-function finitely-generated noise
inverse approximation inverse-function finitely-generated noise
edited Dec 15 '18 at 22:53
Jack Giffin
asked Dec 15 '18 at 22:38
Jack GiffinJack Giffin
17914
17914
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3042040%2finversion-of-gradient-noise-function%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3042040%2finversion-of-gradient-noise-function%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown